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 API retry logic to all Sindri API Calls #118

Closed
KPreisner opened this issue Jul 17, 2024 · 0 comments · Fixed by #120
Closed

Add API retry logic to all Sindri API Calls #118

KPreisner opened this issue Jul 17, 2024 · 0 comments · Fixed by #120
Assignees

Comments

@KPreisner
Copy link
Member

Add API retry logic to all Sindri API Calls

To mitigate common api connectivity issues, we should implement simple retry logic for 502, 503, and 504 error codes.

The sindri python SDK already implements this retry logic. Please use it as a reference.

https://github.com/Sindri-Labs/sindri-python/blob/5da072e1631a13532fbacabfc550ba2b11fe1669/src/sindri/sindri.py#L239-L248

sangaline added a commit that referenced this issue Jul 24, 2024
This adds a second argument to the `SindriClient()` constructor which can
include a `retryOptions` field which controls the newly added retry behavior.
The options are passed through to the `retry` package and are documented
[here](https://www.npmjs.com/package/retry#retrytimeoutsoptions). By default,
we'll retry 4 times with exponential backoff starting at a 1000 ms timeout. The
logic to determine whether to retry is hard-coded, we retry for status codes of
502-504 or any sort of connection errors.

Note that we use a fork of `p-retry` here which supports both ESM and CJS because we provide builds for each in our package (see: sindresorhus/p-retry/issues/76).

Closes #118

Merges #120

LGTM given by: @katiemckeon
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 a pull request may close this issue.

2 participants