Skip to content

Commit 65c7e62

Browse files
fix: support RateLimit-Reset header
Some endpoints are not returning the `Retry-After` header when rate-limiting occurrs. In those cases use the `RateLimit-Reset` header, if available. Closes: #1889
1 parent 85a734f commit 65c7e62

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

gitlab/client.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,8 @@ def http_request(
704704
wait_time = 2 ** cur_retries * 0.1
705705
if "Retry-After" in result.headers:
706706
wait_time = int(result.headers["Retry-After"])
707+
elif "RateLimit-Reset" in result.headers:
708+
wait_time = int(result.headers["RateLimit-Reset"]) - time.time()
707709
cur_retries += 1
708710
time.sleep(wait_time)
709711
continue

0 commit comments

Comments
 (0)