Skip to content

Commit b6e4168

Browse files
committed
bugfix rate limit start
1 parent 4a9679b commit b6e4168

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
@@ -234,7 +234,7 @@ def get_minimal_timeout(self):
234234
def has_limit(self):
235235
return not self._no_limit
236236

237-
def set_limit(self, rate_limit, percentage=80):
237+
def set_limit(self, rate_limit, percentage=100):
238238
with self.__lock:
239239
old_rate_limit_dict = deepcopy(self._rate_limit_dict)
240240
self._rate_limit_dict = {}
@@ -250,7 +250,7 @@ def set_limit(self, rate_limit, percentage=80):
250250
limit = int(int(rate[0]) * percentage / 100)
251251
self._rate_limit_dict[int(rate[1])] = {
252252
"counter": old_rate_limit_dict.get(rate_limit_time, {}).get('counter', 0),
253-
"start": self._rate_limit_dict.get(rate_limit_time, {}).get('start', int(monotonic())),
253+
"start": old_rate_limit_dict.get(rate_limit_time, {}).get('start', int(monotonic())),
254254
"limit": limit}
255255
if rate_limit_time < self._minimal_limit:
256256
self._minimal_timeout = rate_limit_time + 1

0 commit comments

Comments
 (0)