Skip to content

Remove redundant seek in publish_transient_local_messages_before_start_offset - #8

Merged
ajsampathk merged 1 commit into
publish-transient-local-topics-for-start-offsetfrom
claude/review-pr-status-QGFnN
May 10, 2026
Merged

Remove redundant seek in publish_transient_local_messages_before_start_offset#8
ajsampathk merged 1 commit into
publish-transient-local-topics-for-start-offsetfrom
claude/review-pr-status-QGFnN

Conversation

@ajsampathk

Copy link
Copy Markdown

Addresses the review comment from @Hugal31 on #4.

What

The call site in play() was doing readers_->seek(starting_time_) immediately before calling publish_transient_local_messages_before_start_offset(), which itself starts with readers_->seek(earliest_time). This made the first seek wasteful — three seeks in the transient-local path instead of two.

Fix

  • Move the publish_transient_local_messages_before_start_offset() call to before readers_->seek(starting_time_) in the play loop.
  • Remove the redundant final readers_->seek(starting_time_) from inside the function — the caller now owns that single seek.

Edge cases considered

  • Early returns (no transient local topics, start_offset <= 0, or starting_time_ <= earliest_time): function returns without touching the reader; caller's seek still runs correctly.
  • Loop mode: transient local messages are re-published on each iteration as before.
  • Reader position on entry: the function always seeks to earliest_time internally before reading, so pre-call position doesn't matter.
  • Async storage loader: loader is stopped before this code runs and restarted after the seek — no concurrent access issue.

Generated by Claude Code

…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
@ajsampathk
ajsampathk merged commit 2c7ba78 into publish-transient-local-topics-for-start-offset May 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants