Change oyoyo tokenbucket to be consistent with !wait TB
In !wait, the delay is how long it takes (in seconds) to add one token, whereas in oyoyo the delay was the opposite (lower = longer refill). IMO the !wait one makes more sense, so change oyoyo to match.
This commit is contained in:
parent
4077bfe398
commit
e426c25ddd
@ -58,7 +58,7 @@ class TokenBucket(object):
|
||||
def tokens(self):
|
||||
now = time.time()
|
||||
if self._tokens < self.capacity:
|
||||
delta = self.fill_rate * (now - self.timestamp)
|
||||
delta = (now - self.timestamp) / self.fill_rate
|
||||
self._tokens = min(self.capacity, self._tokens + delta)
|
||||
self.timestamp = now
|
||||
return self._tokens
|
||||
|
Loading…
Reference in New Issue
Block a user