Open lojzatran opened 2 years ago
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?
Hi @lojzatran
I will look into this and if it's something we need to implement I will raise a PR for it.
Thanks
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.
nodejs sdk is currently retrying on 503 HTTP error only (https://github.com/commercetools/nodejs/blob/1167644b37db9af7baf511b8b14cdf6abf48f47c/packages/sdk-middleware-http/src/http.js#L215). 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.