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

Retry Middleware II #3996

Open
SJrX opened this issue Jun 13, 2024 · 0 comments
Open

Retry Middleware II #3996

SJrX opened this issue Jun 13, 2024 · 0 comments

Comments

@SJrX
Copy link

SJrX commented Jun 13, 2024

Description

I was curious about how to retry requests in middleware. I did see #546 but it was inconclusive.

The use case we have in mind is transaction management. We use a middleware to be our transaction boundary and this has worked well over the years, and considerably cleaned up our code from having the transactions done at other layers.

Spurious transaction retries are handled by our service mesh following standard REST semantics (DELETE, PUT and GET are retriable), etc....

We do have some cases where retrying POST might make sense, but it's hard to do in the service mesh layer.

It'd be nice if we could call Next() more than once, but the issue is that c.index isn't reset to the current value when Next() returns here https://github.com/gin-gonic/gin/blob/master/context.go#L186 .

It seems like a small refactoring would maybe make that possible, but maybe I'm on the wrong track.

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

1 participant