Skip to content
This repository has been archived by the owner on Dec 29, 2022. It is now read-only.

Retry timeouts #18

Closed
wants to merge 26 commits into from
Closed

Retry timeouts #18

wants to merge 26 commits into from

Conversation

ddoskind
Copy link

No description provided.

pacohh and others added 26 commits July 21, 2017 09:19
These errors are usually transient, and retrying might succeed.

We retry 4 times (for a maximum of 5 requests in total), using an
exponential backoff strategy. The maximum possible delay is thus 15
seconds.

To deactivate the retry mechanism or change the maximum number of
retries, adjust `api.NUM_RETRIES` after the initial import of the
library.
Retry all requests that fail with a 50x error
Ignore worksheets that do not contain cells.
This allows to provide query parameters for the call to the
`spreadsheets.values.get` endpoint used to fetch worksheet content. The
most useful application of this change is to download cell *formulas*
instead of *values*.
For nearly all scenarios, we'd rather wait a bit longer than have our
scripts blow up with a "ReadGroup" rate limit exception.
Increase maximum number of retries
This changes the OAuth2 functionality to use `google-auth` instead of
`oauth2client`, which is [deprecated][0].

It adds a new argument `credentials` to the `API` constructor, which
allows to either use an `Http` object as previously, or to directly
supply a `google.oauth2.credentials.Credentials` instance. Existing code
should thus continue to work unaffected.


[0]: https://google-auth.readthedocs.io/en/latest/oauth2client-deprecation.html
Switch from oauth2client to google-auth
...instead of using a maximum number of retries. This is better suited
to the way rate limiting within the Spreadsheet API seems to work.
Define a maximum amount of time to spend retrying requests
Recently we've been seeing read timeouts when accessing the Sheets API.
This change makes hyou retry those as well.
@googlebot
Copy link

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers

ℹ️ Googlers: Go here for more info.

@ddoskind
Copy link
Author

Whoops, wrong repo. Sorry about that!

@ddoskind ddoskind closed this Feb 26, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants