Remove redundant seek in publish_transient_local_messages_before_start_offset - #8
Merged
ajsampathk merged 1 commit intoMay 10, 2026
Conversation
…start_offset The function always seeks to earliest_time internally before scanning, so the seek(starting_time_) preceding it was wasted. Reorder so the function runs first and the single seek(starting_time_) follows, reducing three seeks to two in the transient-local path. https://claude.ai/code/session_01R4sSw7NnQSaDmgQQB3Z6ZD
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.
Addresses the review comment from @Hugal31 on #4.
What
The call site in
play()was doingreaders_->seek(starting_time_)immediately before callingpublish_transient_local_messages_before_start_offset(), which itself starts withreaders_->seek(earliest_time). This made the first seek wasteful — three seeks in the transient-local path instead of two.Fix
publish_transient_local_messages_before_start_offset()call to beforereaders_->seek(starting_time_)in the play loop.readers_->seek(starting_time_)from inside the function — the caller now owns that single seek.Edge cases considered
start_offset <= 0, orstarting_time_ <= earliest_time): function returns without touching the reader; caller's seek still runs correctly.earliest_timeinternally before reading, so pre-call position doesn't matter.Generated by Claude Code