Skip to content

Commit cf854f3

Browse files
committed
fix rate limit
1 parent 5e7b236 commit cf854f3

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

ally/RateLimit.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ def wait_until_ally_time(req_type):
116116
a_time = now + timedelta(seconds=60.5)
117117

118118
# Block thread
119-
time.sleep((a_time - now).total_seconds())
119+
diff = min(1,a_time - now)
120+
time.sleep(diff.total_seconds())
120121

121122

122123
def check(req_type: RequestType, block: bool):
@@ -139,7 +140,7 @@ def check(req_type: RequestType, block: bool):
139140
if block:
140141
wait_until_ally_time(req_type)
141142
else:
142-
raise RateLimitException("Too many attemps.")
143+
raise RateLimitException("Too many attempts.")
143144

144145

145146
def normal_update(headers_dict, req_type):

0 commit comments

Comments
 (0)