Skip to content

Commit 4f91d86

Browse files
FCE-3295: Fix media event queue order catch (#530)
## Description - `webRTCEndpoint.ts`: chain `.catch()` before `.then()` on `mediaEventQueue` so a rejected prior event doesn't propagate the same rejection to every subsequent `receiveMediaEvent` caller. ## Motivation and Context Previous order assigned the caught queue back to `mediaEventQueue` but returned the uncaught `next`, so one failed handler would reject every queued event after it. Catching first keeps the queue alive and isolates failures to their own caller. ## Documentation impact - [ ] Documentation update required - [ ] Documentation updated [in another PR](_) - [x] No documentation update required ## Types of changes - [x] Bug fix (non-breaking change which fixes an issue) - [ ] New feature (non-breaking change which adds functionality) - [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
1 parent 611b7f8 commit 4f91d86

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

packages/webrtc-client/src/webRTCEndpoint.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,8 @@ export class WebRTCEndpoint extends (EventEmitter as new () => TypedEmitter<Requ
160160
public receiveMediaEvent = (mediaEvent: SerializedMediaEvent): Promise<void> => {
161161
const deserializedMediaEvent = deserializeServerMediaEvent(mediaEvent);
162162

163-
const next = this.mediaEventQueue.then(() => this.handleMediaEvent(deserializedMediaEvent));
164-
this.mediaEventQueue = next.catch(() => undefined);
163+
const next = this.mediaEventQueue.catch(() => undefined).then(() => this.handleMediaEvent(deserializedMediaEvent));
164+
this.mediaEventQueue = next;
165165
return next;
166166
};
167167

0 commit comments

Comments
 (0)