From b9d0576aa3feeff345f02da93fbf23ecab05aba2 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Sun, 10 Jul 2011 15:19:13 -0500 Subject: [PATCH] fixed tokenbucket a bit --- oyoyo/client.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/oyoyo/client.py b/oyoyo/client.py index 2ca169a..b990ce9 100644 --- a/oyoyo/client.py +++ b/oyoyo/client.py @@ -51,11 +51,11 @@ class TokenBucket(object): @property def tokens(self): + now = time() if self._tokens < self.capacity: - now = time.time() delta = self.fill_rate * (now - self.timestamp) self._tokens = min(self.capacity, self._tokens + delta) - self.timestamp = now + self.timestamp = now return self._tokens