| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -700,10 +700,14 @@ def http_request( | |||
| 700 | 700 | if (429 == result.status_code and obey_rate_limit) or ( | |
| 701 | 701 | result.status_code in [500, 502, 503, 504] and retry_transient_errors | |
| 702 | 702 | ): | |
| 703 | + # Response headers documentation: | ||
| 704 | + # https://docs.gitlab.com/ee/user/admin_area/settings/user_and_ip_rate_limits.html#response-headers | ||
| 703 | 705 | if max_retries == -1 or cur_retries < max_retries: | |
| 704 | 706 | wait_time = 2**cur_retries * 0.1 | |
| 705 | 707 | if "Retry-After" in result.headers: | |
| 706 | 708 | wait_time = int(result.headers["Retry-After"]) | |
| 709 | + elif "RateLimit-Reset" in result.headers: | ||
| 710 | + wait_time = int(result.headers["RateLimit-Reset"]) - time.time() | ||
| 707 | 711 | cur_retries += 1 | |
| 708 | 712 | time.sleep(wait_time) | |
| 709 | 713 | continue | |
| Back | FazBrowse Home | New Git URL |
0 commit comments