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

hawkbit-client: handle HTTP errors 409/429 by retrying #102

Merged
merged 1 commit into from
Oct 10, 2021

Conversation

Bastian-Krause
Copy link
Member

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().

src/hawkbit-client.c Outdated Show resolved Hide resolved
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/

Signed-off-by: Bastian Krause <bst@pengutronix.de>
@ejoerns ejoerns added the enhancement New feature or request label Oct 10, 2021
Copy link
Member

@ejoerns ejoerns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good. Rest looks fine for me 👍

@ejoerns ejoerns merged commit 6985270 into rauc:master Oct 10, 2021
@ejoerns ejoerns added this to the Release 1.1 milestone Oct 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants