MONEI / Shopify-api-node

Node Shopify connector sponsored by MONEI
https://monei.com/shopify-payment-gateway/
MIT License
945 stars 278 forks source link

Fix retryable status codes not respecting max retries option #554

Closed jasong689 closed 1 year ago

jasong689 commented 1 year ago

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.

coveralls commented 1 year ago

Coverage Status

Coverage remained the same at 100.0% when pulling f3e627c3e4829cb6f3090505e7bd174f55c58cbd on gadget-inc:respect-max-retries into e9952867bbb1945d9d8932c0b4833478c47efe04 on MONEI:master.

lpinca commented 1 year ago

Can you please address the coverage issue?

jasong689 commented 1 year ago

Will take a look at it

jasong689 commented 1 year ago

@lpinca could you run the workflow again to see if the coverage issue has been resolved

lpinca commented 1 year ago

Thank you.