PermanentOrg / permanent-sdk

Functional Node.js SDK for Permanent.org
MIT License
0 stars 1 forks source link

Support retry logic #149

Open slifty opened 1 year ago

slifty commented 1 year ago

As we explore options for API throttling it might be a useful quality of life to support exponential backoff logic (and, depending on throttling implementation, support for parsing the 429 status code response to detect a Retry-After).

Even without throttling it would be useful to support an optional retry flag when making API calls.

This library exists and looks quite robust: https://github.com/jonbern/fetch-retry

It might be a good option as opposed to implementing this directly ourselves

slifty commented 1 year ago

In terms of our own sdk's API, I don't think it is necessary to expose the full API of something like fetch-retry but to either just do it silently (it seems to me this is the opposite of a breaking change) OR make it customizable via the config object but default retry to true.