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

custom response handlers take instants, not durations? #1

Closed
rgm opened this issue Oct 13, 2022 · 2 comments
Closed

custom response handlers take instants, not durations? #1

rgm opened this issue Oct 13, 2022 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@rgm
Copy link

rgm commented Oct 13, 2022

I hit a 500 in production recently when a rate limit was tripped. I can work around it with a custom response builder.

I'm confused about io.staticweb.rate-limit.responses/add-retry-after-header: when I went logging to debug, it seems retry-after here is a java.time.Instant, not a java.time.Duration.

rgm@f764f8e

I can turn this into a PR if it's helpful and I'm actually correct.

@john-shaffer
Copy link
Contributor

john-shaffer commented Oct 15, 2022

Thank you. That patch is very helpful.

That fix works, but the docs and tests assume that a Duration will be passed to add-retry-after-header. I think it is better to do the Instant to Duration conversion in read-quota-state, which I've done in a3921da. Does latest master fix the issue for you?

@john-shaffer john-shaffer added the bug Something isn't working label Oct 15, 2022
@rgm
Copy link
Author

rgm commented Oct 28, 2022

Sorry, John, took me a bit to circle back to this.

Yes, a3921da works great for me. Your way is (unsurprisingly) better, so I'll close this out. Thank very much.

@rgm rgm closed this as completed Oct 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants