Repository navigation
Add sse_retry and transient_retry: set the retry hints NUTS sends (#145) - #156
Merged
Merged
Conversation
sse_retry <milliseconds> sends retry: with every stream's handshake, so EventSource waits that long after an ordinary disconnect (a dropped network, a reload, a write timeout) instead of the browser's default of a few seconds. 0, the default, sends none. transient_retry <seconds> sets the average of the jittered delay NUTS asks for after a transient failure (the retry stream's retry:, Retry-After) and in the reset frame of a stream whose JetStream stream was recreated or rewound. It stays jittered by ±50%, and 5 seconds remains the default. Both accept up to an hour. Closes #145 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Two directives set the reconnection hints NUTS sends (#145):
sse_retry <milliseconds>sendsretry:with every stream's handshake,just before the
connectedevent. EventSource then waits that long afteran ordinary disconnect (a dropped network, a reload, a write timeout)
instead of the browser's default of a few seconds.
0, the default, sendsnone, as before.
transient_retry <seconds>sets the average of the jittered delay NUTSasks for in three places: the retry stream's
retry:,Retry-Afterforclients that are not EventSource, and the
retry:of the reset frame thatends a stream whose JetStream stream was recreated or rewound (Streams go silent when their stream is recreated under live connections #133,
Send the recreated-stream reset as a reset event (#133 follow-up) #147). The delay stays jittered by ±50%;
0or omitted keeps 5 seconds,so the defaults do not change.
Both accept up to an hour. The Caddyfile parser rejects negative values, and
validation rejects anything over an hour.
Docs: the README (directive list, a "Retry hints" section, the transient
failure text),
docs/CONFIGURATION.md,docs/TROUBLESHOOTING.md, thewebsite's usage page and the CHANGELOG.
Tests
transient_retry(unset, 2 and 30),with both halves of the range reached;
Retry-Afterfollowtransient_retry, and sodoes the reset frame's
retry:;connectedevent carriesretry:withsse_retry;numbers, negative values, over an hour, exactly an hour;
/details, whichCaddyfile.testnow configures withsse_retry 2500.Mutation testing
make mutate-pkg, no mutants lived in any file:caddyfile.goprovision.goserve.goThe not-covered mutants sit on constant declarations and tagless switch
cases, which gremlins cannot see.
scripts/mutate-by-hand.pycovered thenew ones, and 27 hand mutants were all killed. They targeted:
retryDelay, and the width of its jitter;retry:line's format;rejectTransientandendGenerationsend;In the first pass five of them lived. They are now killed by the tests for
exactly an hour, for values that are not numbers, for both halves of the
jitter, and for the reset frame's delay.
🤖 Generated with Claude Code