Calculate duration correctly when pipeline paused #559
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.
I came across this when wanting to get the current duration of a recording from within a plugin..
The pausetype configuration determines which pause method of the Recorder is used when pausing a recording (the two methods are
pause()
orpause_recording()
).The calculation to determine the current duration of the pipeline takes into account the
__pause_timestamp
property of the Recorder, however__pause_timestamp
is only set in pause_recording() not in pause().As a result, when a recording is paused and the pausetype is
pipeline
, any calls toRecorder.get_recording_start_time()
return the incorrect duration of 1439:59. This isn't reflected in the UI because the text for theElapsed Time
only updates when in the recording state, so while paused it displays a stale value.Using the following snippet as a plugin works for testing:
It may be worth refactoring the RecorderService and Recorder at some point so that there is only one Recorder.pause() and Recorder.resume() each with an argument specifying the
pausetype
, for now this PR is all that is required to get the duration calculated correctly.