Skip to content

Commit 4221195

Browse files
AlexandreEXFOJohnVillalovos
authored andcommitted
fix(utils): prevent negative sleep time in rate limit retry
1 parent 9f11323 commit 4221195

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

gitlab/utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def handle_retry_on_status(
133133
if "Retry-After" in headers:
134134
wait_time = int(headers["Retry-After"])
135135
elif "RateLimit-Reset" in headers:
136-
wait_time = int(headers["RateLimit-Reset"]) - time.time()
136+
wait_time = max(0, int(headers["RateLimit-Reset"]) - time.time())
137137
self.cur_retries += 1
138138
time.sleep(wait_time)
139139
return True

0 commit comments

Comments
 (0)