Shopify-api-node icon indicating copy to clipboard operation
Shopify-api-node copied to clipboard

Fix retryable status codes not respecting max retries option

Open jasong689 opened this issue 3 years ago • 0 comments

While writing some tests for our own usage of shopif-api-node, I noticed that retries on retryableStatusCodes were not respecting got's retry limit. According to got's documentation:

This function is responsible for the entire retry mechanism, including the limit property. To support this, you need to check if computedValue is different than 0.

Let's rely on their recommended check to ensure we aren't past the retry limit and ensure that retries are not indefinite if a maxRetries is set. Lastly, since we haven't explicitly included status code 200 as retryable we have to handle "Throttled" requests before attempting to check computedValue.

jasong689 avatar Sep 19 '22 21:09 jasong689