fix(replay): Ensure we do not try to flush when we force stop replay#8783
Merged
fix(replay): Ensure we do not try to flush when we force stop replay#8783
Conversation
mydea
commented
Aug 10, 2023
| // Stop replay if over the mutation limit | ||
| if (overMutationLimit) { | ||
| void this.stop('mutationLimit'); | ||
| void this.stop({ reason: 'mutationLimit', forceFlush: this.recordingMode === 'session' }); |
Member
Author
There was a problem hiding this comment.
For this case we still want to flush I guess? The integration test failed for this, and I guess it is OK to do a final flush here to have details on why this was stopped - we do not add the large mutations anyhow yet, so should be fine?
Contributor
size-limit report 📦
|
billyvg
approved these changes
Aug 10, 2023
009ce34 to
baa242e
Compare
mydea
commented
Aug 10, 2023
| await advanceTimers(160_000); | ||
|
|
||
| expect(mockFlush).toHaveBeenCalledTimes(2); | ||
| expect(mockFlush).toHaveBeenCalledTimes(1); |
Member
Author
There was a problem hiding this comment.
This also shows the incorrect behavior, it was flushing twice before even though it shouldn't have.
baa242e to
bc1b883
Compare
dc1b624 to
81ed9bd
Compare
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.
In our
stop()method, we always tried to force a final flush when insessionmode.However, that may lead to weird behaviour when we internally
stop()due to a failure - e.g. think a send replay request fails, we do not want to force a flush again in that case.Note that in tests this seems to be generally passing because
flush()usually has a running_flushLockat this time and thus does not attempt to flush again immediately but only schedules a flush later. I added a test that properly failed for this before and is now fixed.