Repository navigation
fix(digest): drain queue and flush on channel close; graceful shutdown - #351
Merged
Merged
Conversation
The digest select loop never observed channel closure (the interval branch was always ready), and main aborted the task after serve returned, losing acked events. Handle recv() == None by flushing and exiting, add SIGINT/SIGTERM graceful shutdown, and await the digest task with a bounded timeout instead of abort(). Closes #331 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
What
DigestTask::run: handlerx.recv() == Noneexplicitly (flush partial batch, break). Previously theSome(..)pattern only disabled the branch while the interval branch stayed ready, so the loop never exited.main.rs: add SIGINT/SIGTERM graceful shutdown (bounded 10s HTTP grace), drop the server/router state soingest_txcloses, then await the digest task with a 10s timeout instead ofabort().Why
Events already acked with HTTP 200 (buffered batch + queued in the mpsc) were lost on SIGTERM/restart. Closes #331
Testing
drains_partial_batch_and_exits_on_channel_closeanddrains_multiple_batches_on_channel_close; both FAIL on the old loop (timeout, task never exits) and pass now.cargo fmt --check: OKcargo clippy --workspace --all-targets -- -D warnings: cleancargo test --workspace: all passDeferred: webhook/ws consumers not changed (WS bridge ends when digest drops its sender).
🤖 Generated with Claude Code