diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-20 20:18:11 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2010-12-20 20:18:11 +0100 |
commit | 9666001e570275fa08a5766639c437d40bbb0545 (patch) | |
tree | 174566817e3b11f09cbc5dbdb02dd72558e629fc /module/network/Bucket.py | |
parent | bucket improvement (diff) | |
download | pyload-9666001e570275fa08a5766639c437d40bbb0545.tar.xz |
improved bucket
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() |