fix(utils): prevent negative sleep time in rate limit retry · python-gitlab/python-gitlab@4221195

Skip to content

Navigation Menu

Sign in

Appearance settings

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

Appearance settings

Commit 4221195

AlexandreEXFOJohnVillalovos

authored and

committed

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

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)