diff options
Diffstat (limited to 'module/network/Bucket.py')
-rw-r--r-- | module/network/Bucket.py | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/module/network/Bucket.py b/module/network/Bucket.py index 04b706ff2..434cbe662 100644 --- a/module/network/Bucket.py +++ b/module/network/Bucket.py @@ -28,14 +28,16 @@ class Bucket: self.lock = Lock() def setRate(self, rate): + self.lock.acquire() self.rate = rate + self.lock.release() def add(self, amount): self.lock.acquire() self.drip() allowable = min(amount, self.rate - self.content) - if allowable < 3072: - allowable = 0 + if allowable > 0: + sleep(0.005) self.content += allowable self.lock.release() |