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

Overwrite Retryconditions #868

Closed
wasserholz opened this issue Sep 23, 2024 · 8 comments
Closed

Overwrite Retryconditions #868

wasserholz opened this issue Sep 23, 2024 · 8 comments
Assignees
Labels
feature v3 For resty v3

Comments

@wasserholz
Copy link

First of all, thanks for this great rest client.

Currently it is not possible to overwrite retry conditions on a request

Use case:
Most requests to a specific API should retry on any error except for one endpoint.
For that one endpoint I am creating an object and the endpoint returns 400 with an app error code specific to that endpoint. As the object exists, it is fine to not retry.

I have now a client wide retry on error, AddRetryAfterErrorCondition(), but for that one request I want it do use my customer retry function only. This would only work if I manually remove the client wide retry condition or use a new client for this specific request.

It would be great to be able to overwrite client wide configuration in each request, so it is possible to avoid work-arounds.

@wasserholz
Copy link
Author

For now I have encapsulated the rest client into a wrapper type with receiver functions, which then add the retry conditions on each request to avoid repetition and client wide config.

@jeevatkm
Copy link
Member

@wasserholz Thanks for reaching out. In the upcoming Resty v3, retry controls will be added to the Request level to prevent retrying on particular requests; refer to #752.
Can you elaborate on the overwrite condition? I do not understand. Typically, conditions will not occur when you turn off the retry on request.

@jeevatkm
Copy link
Member

@wasserholz, I thought I would check with you regarding my above comment.

@jeevatkm
Copy link
Member

jeevatkm commented Nov 5, 2024

@wasserholz I thought I would check with you again.

@jeevatkm
Copy link
Member

I'm closing it.

@wasserholz
Copy link
Author

Sorry for not answering earlier. The use case is following:
Most REST API endpoints in the service need to be checked just if error code >= 400

But one specific endpoint needs to have a more granular check for specific error codes. e.g. fail on all error codes except error code 418
The general check was applied on the rest client and the second one on a specific request.
The rest client wide check was still happening, so the call failed even if it should succeed.

@jeevatkm
Copy link
Member

jeevatkm commented Dec 31, 2024

@wasserholz Thanks for getting back.

So your use case is to apply only the request retry conditions, not the client retry conditions for the specific requests, right?

@jeevatkm jeevatkm reopened this Jan 5, 2025
@jeevatkm jeevatkm self-assigned this Jan 5, 2025
@jeevatkm jeevatkm added feature v3 For resty v3 labels Jan 5, 2025
@jeevatkm jeevatkm added this to the v3.0.0 Milestone milestone Jan 5, 2025
jeevatkm added a commit that referenced this issue Jan 5, 2025
- refactor retry conditions and hooks into accepting multiple values
jeevatkm added a commit that referenced this issue Jan 5, 2025
- refactor retry conditions and hooks into accepting multiple values
@jeevatkm
Copy link
Member

jeevatkm commented Jan 5, 2025

Done!

@jeevatkm jeevatkm closed this as completed Jan 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature v3 For resty v3
Development

No branches or pull requests

2 participants