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 exponential backoff as an option when creating the client. #13

Open
sl33t opened this issue Jul 30, 2018 · 3 comments
Open

Add exponential backoff as an option when creating the client. #13

sl33t opened this issue Jul 30, 2018 · 3 comments

Comments

@sl33t
Copy link
Contributor

sl33t commented Jul 30, 2018

If you fire off a lot of requests at one time it is possible to go over the 100 requests in 100 seconds limit. Once it hits that limit datasheets throws an error. It should be possible to have datasheets retry by default using something like exponential backoff.

@zcmarine
Copy link
Contributor

Hey Ricky, greetings from Ethiopia. :)

That makes sense to me and seems reasonable. Any interest in taking a shot at implementing this?

A quick search makes it look like this isn't built into the Google Sheets or Google Drive APIs, which I'm not surprised by. My thought is that we could have a decorator that does a try-except for the appropriate errors and is smart enough to keep track of how much more to back off.

Also, we likely want a maximum back off, at a minimum for non-service-account clients. The reasoning there is that the typical use case of non-service-account access is interactive use, and if the issue is something like internet connectivity being down then it'd be better to give quick feedback than have the user's code hang forever. I guess there should be an upper limit for service account use as well, though maybe it could be higher.

What do you think?

@sl33t
Copy link
Contributor Author

sl33t commented Jul 31, 2018

I will try to take a shot at it before I leave squarespace. I think the decorator is a great solution. Only problem right now is it should probably be behind the auth library change as the error will change when we change packages.

Maximum backoff sounds like a better idea. The quicker feedback would be useful. Service accounts should have a higher threashold enabling them to be more resilient as they are usually used in automation.

@sl33t
Copy link
Contributor Author

sl33t commented Aug 16, 2018

__getattribute__ might be a better place for it then a decorator. It will let us control exactly when it is called.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants