Skip to content

Commit 97cfccd

Browse files
authored
Merge pull request #88 from bartvenmans/set-rate-limit
bugfix rate limit start
2 parents 16f0da5 + b6e4168 commit 97cfccd

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

tb_device_mqtt.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ def get_minimal_timeout(self):
233233
def has_limit(self):
234234
return not self._no_limit
235235

236-
def set_limit(self, rate_limit, percentage=80):
236+
def set_limit(self, rate_limit, percentage=100):
237237
with self.__lock:
238238
self._minimal_timeout = DEFAULT_TIMEOUT
239239
self._minimal_limit = 1000000000
@@ -254,7 +254,7 @@ def set_limit(self, rate_limit, percentage=80):
254254
limit = int(int(rate[0]) * percentage / 100)
255255
self._rate_limit_dict[int(rate[1])] = {
256256
"counter": old_rate_limit_dict.get(rate_limit_time, {}).get('counter', 0),
257-
"start": self._rate_limit_dict.get(rate_limit_time, {}).get('start', int(monotonic())),
257+
"start": old_rate_limit_dict.get(rate_limit_time, {}).get('start', int(monotonic())),
258258
"limit": limit}
259259
if rate_limit_time < self._minimal_limit:
260260
self._minimal_timeout = rate_limit_time + 1

0 commit comments

Comments
 (0)