hawkbit-client: handle HTTP errors 409/429 by retrying #102
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
hawkBit's DDI API [1] returns a HTTP 409 error code (Conflict) in case another transaction is ongoing:
"E.g. in case an entity is created or modified by another user in another request at the same time. You may retry your modification request." [1]
Another HTTP error code we should handle is 429 (Too Many Requests):
"Too many requests. The server will refuse further attempts and the client has to wait another second." [1]
Both error conditions are now handled by waiting (1 second) and retrying the request again. Retrys are currently limited to 10.
[1] https://www.eclipse.org/hawkbit/apis/ddi_api/
While at it, improve setting errors in
rest_request()
.