Auto Retrying aws-api-gateway-client requests, with delay between retries...

aws-api-gateway-client allows for automatic retries, but can we configure the delay between retries?

Auto Retrying aws-api-gateway-client requests, with delay between retries...

I have an application in production that depends on a backend api that is hosted behind the Amazon API gateway. Generally this works great, but occasionally there are gateway timeouts and so-forth, and the mechanism we've had in place to retry unsuccessful requests was sort of a naive implementation that doesn't really work.

As it turns out, the aws-api-gateway-client package does allow automatic retries. However, at the time of this writing, it does not allow user configurable delay between retries, and the default is no delay. That's somewhat less than useful, to the point the auto-retries might as well not even be enabled in many cases.

To my mind, that's like having a high-end sports car, and taking it to some random shade-tree mechanic for an oil change just to save a buck or two on the dealer's service cost. Ok, that's not a great analogy, but you get where I'm going with it...

Under the hood, the aws-api-gateway-client uses axios to make requests, and makes use of axios-retry to provide automatic retry functionality. Axios-retry does provide a means of setting the delay between retries, and includes an exponential backoff method too, but the aws-api-gateway-client package does not expose a way to configure it, so we're stuck with the default of no delay between retries.

That is, unless/until my recently opened PR gets accepted...

UPDATE: My PR was accepted :)


Share Tweet Send
0 Comments