Skip to content

Commit e1bf411

Browse files
author
Greg Russell
committed
Fix time arithmetic
1 parent 0f1394d commit e1bf411

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

bq/insert.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ func (in *BQInserter) Flush() error {
263263
}
264264
metrics.WarningCount.WithLabelValues(in.TableBase(), "", "Quota Exceeded").Inc()
265265
// Use some randomness to reduce risk of synchronization across tasks.
266-
time.Sleep(time.Seconds((0.5 + rand.Float64()) * in.params.RetryDelay.Seconds()))
266+
t := in.params.RetryDelay.Seconds() * (0.5 + rand.Float64()) // between 0.5 and 1.5 * RetryDelay
267+
time.Sleep(time.Duration(1000000*t) * time.Microsecond)
267268
}
268269

269270
// If there is still an error, then handle it.

0 commit comments

Comments
 (0)