You signed in with another tab or window.Reload to refresh your session.You signed out in another tab or window.Reload to refresh your session.You switched accounts on another tab or window.Reload to refresh your session.Dismiss alert
Package`go-github-ratelimit`providesa middleware (http.RoundTripper) that handles both[Primary Rate Limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-primary-rate-limits) and[Secondary Rate Limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-secondary-rate-limits) for the GitHub API.
5
+
Package`go-github-ratelimit`provides a middleware (http.RoundTripper) that handles both[Primary Rate Limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-primary-rate-limits) and[Secondary Rate Limit](https://docs.github.com/en/rest/using-the-rest-api/rate-limits-for-the-rest-api?#about-secondary-rate-limits) for the GitHub API.
6
6
7
7
* Primary rate limits are handled by returning a detailed error.
8
8
* Secondary rate limits are handled by waiting in blocking mode (sleep) and then issuing/retrying requests.
@@ -24,22 +24,21 @@ It is best to stack the pagination round-tripper on top of the rate limit round-
24
24
25
25
##Usage Example (with[go-github](https://github.com/google/go-github))
26
26
27
+
see[example/basic.go](example/basic.go) for a runnable example.
-`WithLimitDetectedCallback(callback)`: the callback is triggered before a sleep.
63
62
-`WithSingleSleepLimit(duration, callback)`: limit the sleep duration for a single secondary rate limit & trigger a callback when the limit is exceeded.
@@ -72,18 +71,8 @@ as well as fine-grained policy control (e.g., for a sophisticated pagination mec
72
71
73
72
##Advanced Example
74
73
74
+
See[example/advanced.go](example/advanced.go) for a runnable example.