Throttle requests to mitigate RateLimitExceededExceptions (#2145)

This introduces a throttling of requests to the Github REST API (1s for writes, 0.25s for reads, configurable)
to mitigate secondary rate limit errors and comply with Github's best practices:

https://docs.github.com/en/rest/guides/best-practices-for-integrators?apiVersion=2022-11-28#dealing-with-secondary-rate-limits
This commit is contained in:
Enrico Minack
2023-06-28 21:38:29 +02:00
committed by GitHub
parent 0bb72ca004
commit 99155806ed
11 changed files with 304 additions and 49 deletions
+3
View File
@@ -18,12 +18,15 @@ class GithubIntegration:
integration_id: Optional[Union[int, str]] = ...,
private_key: Optional[str] = ...,
base_url: str = ...,
*,
timeout: int = ...,
user_agent: str = ...,
per_page: int = ...,
verify: Union[bool, str] = ...,
retry: Optional[Union[int, Retry]] = ...,
pool_size: Optional[int] = ...,
seconds_between_requests: Optional[float] = ...,
seconds_between_writes: Optional[float] = ...,
jwt_expiry: int = ...,
jwt_issued_at: int = ...,
jwt_algorithm: str = ...,