Repository navigation
fix: send the buffered writer's remaining lines at shutdown - #146
Merged
Merged
Conversation
andersvw
marked this pull request as ready for review
October 19, 2026 23:42
ecbadeaux
reviewed
Oct 20, 2026
The buffered writer sends only full buffers. When it is destroyed at exit, the sending thread stops and whatever is still in the buffer is dropped, so a process that exits before it fills one buffer never sends those meters. NDrive hit this with a counter it records when startup fails a second after launch: it never reached spectatord. ~Writer now sends the rest of the buffer after it joins the sending thread. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
andersvw
force-pushed
the
writer-flush-on-shutdown
branch
from
October 20, 2026 18:49
1ff4613 to
5d9294a
Compare
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.
Notes
With a buffer size set, the writer sends only full buffers, and
~Writerjoined the sending thread and dropped whatever was left, so a process that exits before it fills one buffer never sends those meters.~Writernow sends the rest of the buffer, under the write mutex, after the sending thread has joined. NDrive hit this with a startup-failure counter that its sidecar records a second before it exits.Testing
Just the new test without the source code fix:
🤖 Generated with Claude Code