Skip to content

Commit

Permalink
feat(replay): handle ReplayManager#seek before streams get registered
Browse files Browse the repository at this point in the history
Streams get registered on deployment start. #seek will usually be called
within the setup step (that is, before any deployment actually start)

When this happens, save the seek argument and process it after the first
stream gets added
  • Loading branch information
doudou committed Jan 12, 2024
1 parent 99756b9 commit bf50aa7
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/syskit/log/replay_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,12 @@ def register(deployment_task)

if stream_aligner.add_streams(*new_streams)
_, @time = stream_aligner.step_back
reset_replay_base_times
else
reset_replay_base_times
seek(@initial_seek) if @initial_seek
@time = stream_aligner.eof? ? end_time : start_time
end
reset_replay_base_times
end

# @api private
Expand Down Expand Up @@ -173,6 +174,11 @@ def deregister(deployment_task)

# Seek to the given time or sample index
def seek(time_or_index)
if stream_aligner.empty?
@initial_seek = time_or_index
return
end

stream_index, time = stream_aligner.seek(time_or_index, false)
return unless stream_index

Expand Down

0 comments on commit bf50aa7

Please sign in to comment.