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

Retry on 5xx HTTP error #1743

Open
lojzatran opened this issue Dec 17, 2021 · 3 comments
Open

Retry on 5xx HTTP error #1743

lojzatran opened this issue Dec 17, 2021 · 3 comments
Assignees

Comments

@lojzatran
Copy link

nodejs sdk is currently retrying on 503 HTTP error only (

if (res.status === 503 && enableRetry)
). According to the CTP documentation it should retry at least on 502 HTTP error (https://docs.commercetools.com/api/errors#502-bad-gateway). You may consider retrying also on other 5xx HTTP errors where it makes sense.

@lojzatran
Copy link
Author

Also is it possible to add own retry rules? E.g. we want to retry in some specific 4xx errors that we have confirmed from support that they should be retried. In the old sphere-node-sdk we have retryKeywords and we could also configure them: https://github.com/commercetools/sphere-node-sdk/blob/master/src/coffee/repeater-task-queue.coffee#L7. How could this be done in the current nodejs sdk?

@ajimae
Copy link
Contributor

ajimae commented Feb 7, 2022

Hi @lojzatran

I will look into this and if it's something we need to implement I will raise a PR for it.

Thanks

@butenkor
Copy link
Member

The question is how reliable is to have error codes only since some of the errors which are listed in the the old keywords SDK are not related to the API response code (since commercetools server is not reached) but also OS limitation like amount of possible concurrent connection and similar - in such cases it would allow the user to retry automatically too.

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

No branches or pull requests

3 participants