custom response handlers take instants, not durations?
rgm opened this issue · 2 comments
rgm commented
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
.
I can turn this into a PR if it's helpful and I'm actually correct.
john-shaffer commented
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?