fix(replay): Fixes potential out-of-order segments#13609
Merged
Conversation
This fixes a potential issue where our flush "lock" was not being respected in two cases: 1) No current flush in progress, but flush throws an error (this should be rare as the common errors that get thrown should stop the replay completely) 2) Flush is in progress, which skips the code block that releases lock and then calls debouncedFlush. This leaves the lock always set to a resolved (or rejected) promise. This ultimately should not change too much as the flush calls are debounced anyway, but this cleans up the code a bit and also logs any exceptions that may occur.
c298lee
reviewed
Sep 6, 2024
|
|
||
| // this._flushLock acts as a lock so that future calls to `_flush()` | ||
| // will be blocked until this promise resolves | ||
| const _flushInProgress = !!this._flushLock; |
Member
Author
There was a problem hiding this comment.
Ah it's a shortcut to coerce to a boolean instead of e.g. Boolean()
c298lee
approved these changes
Sep 6, 2024
mydea
approved these changes
Sep 9, 2024
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.
This fixes a potential issue where segments can come in out of order due to our flush "lock" was not being respected in two cases:
This ultimately should not change too much as the flush calls are debounced anyway, but this cleans up the code a bit and also logs any exceptions that may occur. However this can fix issues where segments can come in out of order depending on how long the send request takes. e.g.
where ideally it looks like
