Open butenkor opened 8 years ago
This can be solved by using the retry util from sphere-node-utils, it doesn't need to be in the sdk
How this can be solved with sphere-node-utils? Can you provide an example? Also why would every user need to implement retry if it could be done easily by SDK? It is common for SDKs to provide such functionality: https://github.com/aws/aws-sdk-java/blob/master/aws-java-sdk-core/src/main/java/com/amazonaws/retry/RetryPolicy.java
https://packagist.org/packages/postmen/sdk-php#user-content-automatic-retry-on-retryable-error
I forgot that the API now returns the current version in the error message. http://dev.commercetools.com/http-api-errors.html#409-conflict
It would be easier to implement then. It would be good if you can provide a PR ;)
Expected behavior
If i update product and concurrent modification exception is thrown by API, SDK should use new version from API error response and retry payload. This behaviour should be configurable (i.e.: on client instantiation. Nice to have: per endpoint). More details on error: http://dev.commercetools.com/http-api-errors.html#409-conflict
Actual behavior
It rejects with concurrent modification error from API
Steps to reproduce the behavior
Update product attribute and publish at the same time