Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add jitter correction for rate limit handling #147

Merged

Conversation

imjaroiswebdev
Copy link
Collaborator

Add jitter correction to ratelimit headers handling, additionally addresses case when no headers were present, but 429 error is received.

Introduced new test cases...

$ make test TESTARGS="-v -run TestHandleRatelimitError"
==> Testing go-pagerduty
=== RUN   TestHandleRatelimitErrorWithRatelimitHeaders
2023/12/11 21:33:16 ===== PagerDuty Cache Skipping Init =====
[INFO] Rate limit hit, throttling by 2.6 seconds until next retry to GET: http://127.0.0.1:51483/teams
--- PASS: TestHandleRatelimitErrorWithRatelimitHeaders (2.64s)
=== RUN   TestHandleRatelimitErrorNoRatelimitHeaders
===== PagerDuty Cache Skipping Init =====
[INFO] Rate limit hit, throttling by 6.4 seconds until next retry to GET: http://127.0.0.1:51485/teams
--- PASS: TestHandleRatelimitErrorNoRatelimitHeaders (6.38s)
PASS
ok      github.com/heimweh/go-pagerduty/pagerduty       9.262s
testing: warning: no tests to run
PASS
ok      github.com/heimweh/go-pagerduty/persistentconfig        0.319s [no tests to run]

@imjaroiswebdev imjaroiswebdev merged commit 0de11cd into heimweh:master Dec 12, 2023
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant