mirror of
https://github.com/ollama/ollama.git
synced 2025-08-24 20:11:21 +02:00
no divide by zero
This commit is contained in:
@@ -105,7 +105,12 @@ func (b *Bar) percent() float64 {
|
||||
}
|
||||
|
||||
func (b *Bar) rate() float64 {
|
||||
return (float64(b.currentValue) - float64(b.initialValue)) / b.elapsed().Seconds()
|
||||
elapsed := b.elapsed()
|
||||
if elapsed.Seconds() > 0 {
|
||||
return (float64(b.currentValue) - float64(b.initialValue)) / elapsed.Seconds()
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
func (b *Bar) elapsed() time.Duration {
|
||||
|
Reference in New Issue
Block a user