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

Should retry on concurrent modification error #129

Open
butenkor opened this issue May 10, 2016 · 3 comments
Open

Should retry on concurrent modification error #129

butenkor opened this issue May 10, 2016 · 3 comments

Comments

@butenkor
Copy link
Member

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

@emmenko
Copy link
Member

emmenko commented May 10, 2016

This can be solved by using the retry util from sphere-node-utils, it doesn't need to be in the sdk

@butenkor
Copy link
Member Author

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

@emmenko
Copy link
Member

emmenko commented May 10, 2016

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 ;)

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

2 participants