mirror of
https://github.com/ChronosX88/go-throttle.git
synced 2024-11-21 20:12:17 +00:00
Fix refillrate setting on Take
This commit is contained in:
parent
8752f68e29
commit
e7a5e86067
@ -96,7 +96,7 @@ func (t *Throttle) Take(rateLimit time.Duration, cost float64) rxgo.Observable {
|
|||||||
if rateLimit == 0 {
|
if rateLimit == 0 {
|
||||||
t.config.RefillRate = 0
|
t.config.RefillRate = 0
|
||||||
} else {
|
} else {
|
||||||
t.config.RefillRate = float64(1 / rateLimit.Nanoseconds())
|
t.config.RefillRate = 1.0 / float64(rateLimit.Nanoseconds())
|
||||||
}
|
}
|
||||||
return rxgo.FromChannel(ch)
|
return rxgo.FromChannel(ch)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user