fix(replay): Use session.started
for min/max duration check
#8617
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.
We've been using
context.initialTimestamp
to check for min/max session duration, but actually this is always updated when a tab is refreshed, for example.Instead, we now use
session.started
, which should also always be updated for a buffer session.note that this also means, when an error happens, we flush immediately, but then wait for 5s until we flush again (which is fine, I'd say) - because at the time of conversion of buffer->session, we update the
started
of the session. But that's OK I'd say?I also updated the logging to be based on this. Overall having a log for the buffer->session change makes sense to me anyhow, plus I also added one for the only other case where
session.started
is updated.Note: I added a test to kind of cover this, but this test also passed with the previous version, so 🤷 not entirely sure how to test this better 😬