From e7a5e8606779a4e7d937bdef984da5e59e3f853f Mon Sep 17 00:00:00 2001 From: ChronosX88 Date: Mon, 25 Jan 2021 17:47:18 +0300 Subject: [PATCH] Fix refillrate setting on Take --- throttle.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/throttle.go b/throttle.go index 9a960c1..e1f3789 100644 --- a/throttle.go +++ b/throttle.go @@ -96,7 +96,7 @@ func (t *Throttle) Take(rateLimit time.Duration, cost float64) rxgo.Observable { if rateLimit == 0 { t.config.RefillRate = 0 } else { - t.config.RefillRate = float64(1 / rateLimit.Nanoseconds()) + t.config.RefillRate = 1.0 / float64(rateLimit.Nanoseconds()) } return rxgo.FromChannel(ch) }