Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit d637206

Browse files
authored
setting default wait_time to 1 minute
For Gitlab.com most rate limits are calculated per 1 minute. Better to set the default timeout to that value
1 parent ca98d88 commit d637206

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

gitlab/client.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -729,8 +729,10 @@ def http_request(
729729
):
730730
# Response headers documentation:
731731
# https://docs.gitlab.com/ee/user/admin_area/settings/user_and_ip_rate_limits.html#response-headers
732+
# For gitlab.com:
733+
# https://docs.gitlab.com/ee/user/gitlab_com/index.html#gitlabcom-specific-rate-limits
732734
if max_retries == -1 or cur_retries < max_retries:
733-
wait_time = 2**cur_retries * 0.1
735+
wait_time = 60 # In gitlab.com limits are calculated per minute. Better to be on the safe side in case headers are missing
734736
if "Retry-After" in result.headers:
735737
wait_time = int(result.headers["Retry-After"])
736738
elif "RateLimit-Reset" in result.headers:

0 commit comments

Comments
 (0)