forked from andygrunwald/go-jira
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Back off and retry whenever API rate limits are reached (#10)
Atlassian applies rate limiting to Jira's REST APIs [1]. When the rate limit for a particular endpoint has been reached, Jira produces a response that is compatible with RFC 6585 section 4: the status is set to `429 Too Many Requests`, and the client is expected not to reattempt the request until at least the number of seconds given by the `Retry-After` header have elapsed. Currently the default `Client` and the built-in `Transport`s do not respect any rate limits, and exceeding them results in errors. Use `github.com/hashicorp/go-retryablehttp` to implement RFC 6585 section 4 in the default `Client` and built-in `Transport`s so that the API rate limits are respected. A welcome side-effect is that failed requests due to (e.g.) network problems will also be retried (up to a maximum of 4 times, go-retryablehttp's default). [1] https://developer.atlassian.com/cloud/jira/platform/rate-limiting/
- Loading branch information
1 parent
2538602
commit b7c0ef6
Showing
5 changed files
with
138 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><title>Oops - an error has occurred</title><link type='text/css' rel='stylesheet' href='/static-assets/metal-all.css' media='all'><script src='/static-assets/metal-all.js'></script><meta name="decorator" content="none" /></head><body class=" error-page error429"><script type="text/javascript">document.body.className += " js-enabled";</script><div id="page"><header id="header" role="banner"></header><!-- #header --><section id="content" role="main"><div class="aui-page-panel"><div class="aui-page-panel-inner"><section class="aui-page-panel-content lowerContent"><div id="error-state"><span class="error-type"></span><h1>Something went wrong</h1><p>Try reloading the page, then check our <a href="https://status.atlassian.com">Statuspage</a> for any current outages. If there are no relevant outages, create a <a href="https://support.atlassian.com/contact/">support request</a> so we can help you out.</p><p>If you create a request, include the following so we can help you as fast as possible:</p><ul><li>Error type: <strong>429 - Too many requests</strong></li><li>Log reference: <strong>00000000-0000-4000-0000-000000000000</strong></li></ul></div></section><!-- .aui-page-panel-content --></div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel --></section><!-- #content --><footer id="footer" role="contentinfo"><section class="footer-body"><div id="footer-logo"><a href="http://www.atlassian.com/" rel="nofollow">Atlassian</a></div></section></footer><!-- #footer --></div><!-- #page --></body></html> |