Commit 8fcee67
authored
fix(replay): Fixes potential out-of-order segments (#13609)
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:
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. 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
1 parent d4a2fcd commit 8fcee67
File tree
2 files changed
+73
-13
lines changed- packages/replay-internal
- src
- test/integration
2 files changed
+73
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1226 | 1226 | | |
1227 | 1227 | | |
1228 | 1228 | | |
1229 | | - | |
1230 | | - | |
| 1229 | + | |
| 1230 | + | |
| 1231 | + | |
| 1232 | + | |
1231 | 1233 | | |
1232 | 1234 | | |
1233 | | - | |
1234 | | - | |
1235 | | - | |
1236 | 1235 | | |
1237 | 1236 | | |
1238 | | - | |
1239 | | - | |
1240 | | - | |
1241 | | - | |
1242 | | - | |
1243 | | - | |
1244 | 1237 | | |
1245 | 1238 | | |
1246 | 1239 | | |
1247 | | - | |
| 1240 | + | |
1248 | 1241 | | |
1249 | | - | |
| 1242 | + | |
| 1243 | + | |
| 1244 | + | |
| 1245 | + | |
| 1246 | + | |
| 1247 | + | |
| 1248 | + | |
| 1249 | + | |
| 1250 | + | |
| 1251 | + | |
1250 | 1252 | | |
1251 | 1253 | | |
1252 | 1254 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
493 | 493 | | |
494 | 494 | | |
495 | 495 | | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
496 | 554 | | |
497 | 555 | | |
498 | 556 | | |
| |||
0 commit comments