Fix an incorrected finish which halted playback prematurely. The scenario was that there were events being rapidly added to the recording. (#606)

This commit is contained in:
Eoghan Murray
2026-04-01 12:00:00 +08:00
committed by GitHub
parent 880cc3ab9e
commit 38a9e36b8f

View File

@@ -493,13 +493,16 @@ export class Replayer {
this.service.send({ type: 'CAST_EVENT', payload: { event } });
// events are kept sorted by timestamp, check if this is the last event
let last_index = this.service.state.context.events.length - 1;
if (
event ===
this.service.state.context.events[
this.service.state.context.events.length - 1
]
this.service.state.context.events[last_index]
) {
const finish = () => {
if (last_index < this.service.state.context.events.length - 1) {
// more events have been added since the setTimeout
return;
}
this.backToNormal();
this.service.send('END');
this.emitter.emit(ReplayerEvents.Finish);