-
Notifications
You must be signed in to change notification settings - Fork 88
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
handle rate limiter & github server-side errors #63
base: master
Are you sure you want to change the base?
Conversation
Hi @mredolatti, thanks for your contribution! In order for us to evaluate and accept your PR, we ask that you sign a contribution license agreement. It's all electronic and will take just minutes. |
You did it @mredolatti! Thank you for signing the Singer Contribution License Agreement. |
raise AuthException(resp.text) | ||
if resp.status_code == 404: | ||
raise NotFoundException(resp.text) | ||
for _ in range(0, 3): # 3 attempts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couldn't this be replaced with the backoff
library?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @luandy64 i'm not familiar with that library, but i'll look into it as soon as possible and tidy up the PR.
Thanks and sorry for the delay!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mredolatti I sumbled on this example: https://github.com/singer-io/tap-exchangeratesapi/blob/master/tap_exchangeratesapi/__init__.py#L38
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll take a look at this tonight and see if I can put the branch up to speed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@luandy64 @osterman could it be that the backoff library doesn't provide an easy way to use headers like: X-RateLimit-Remaining, X-RateLimit-Reset
to determine how long to back off: litl/backoff#38?
Are there plans to work on this? @osterman or @mredolatti ? I am having the same issue as well |
@cmerrick @mredolatti any way we can help to get this over the line? |
@nehiljain Sorry - no resources available on outside to put towards it at this time |
@osterman @mredolatti @luandy64, what needs to happen to merge this PR? It looks like the code that's there already is much better than the current code, which has no retry capability. Also, it doesn't look like backoff will handle the rate limit headers anyway. This issue is blocking me from using Stitch's hosted Github tap, and instead I have to run it on my own. |
Up! Can we merge this? |
@luandy64 can we merge this PR or is has it been implemented elsewhere? Hitting the GitHub ratelimit is affection our ability to use Stitch as well |
is this still an issue? i took a look at backoff a while ago and didn't see a straightforward way to use it while relying on the response's headers to actually wait the correct amount of time. Do we need to add that behavior into |
@mredolatti latest backoff (2.0.1) has the |
@mredolatti @bgreen-litl basic backoff functionality was added in #143. This PR should probably be closed and a custom wait time functionality can be added in a new PR based on the latest version in master. |
@savicbo @mredolatti @bgreen-litl @antoine-lizee @KBorders01 @henriblancke @nehiljain Correct me if I'm wrong, but if you run tap-github/tap_github/__init__.py Lines 198 to 207 in 4f7ba58
|
@luandy64 that is correct, it looks like this issue has been resolved in another PR. |
Two issues were found while using this library:
To deal with these scenarios, simple retry logic was added, and in the case of a rate limiting situation, we wait until the next reset time to move forward with the next retry.