From 59d722f882cebaf8586d7ad6056899e6a6b21b5b Mon Sep 17 00:00:00 2001 From: CSantosM <4a.santos@gmail.com> Date: Wed, 4 Feb 2026 15:20:12 +0100 Subject: [PATCH] backend: enhance recording start process sending FAILED event to client when an error occurs --- meet-ce/backend/src/services/recording.service.ts | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/meet-ce/backend/src/services/recording.service.ts b/meet-ce/backend/src/services/recording.service.ts index 1dd03ff9..5d8bd480 100644 --- a/meet-ce/backend/src/services/recording.service.ts +++ b/meet-ce/backend/src/services/recording.service.ts @@ -85,19 +85,21 @@ export class RecordingService { status: MeetRecordingStatus.STARTING }); + // Promise that rejects after timeout const timeoutPromise = new Promise((_, reject) => { timeoutId = setTimeout(() => { if (isOperationCompleted) return; isOperationCompleted = true; - //Clean up the event listener and timeout + // Clean up the event listener and timeout this.systemEventService.off(DistributedEventType.RECORDING_ACTIVE, eventListener); this.handleRecordingTimeout(recordingId, roomId).catch(() => {}); reject(errorRecordingStartTimeout(roomId)); }, ms(INTERNAL_CONFIG.RECORDING_STARTED_TIMEOUT)); }); + // Promise that resolves when RECORDING_ACTIVE event is received const activeEgressEventPromise = new Promise((resolve) => { eventListener = (info: Record) => { // Process the event only if it belongs to the current room. @@ -114,6 +116,7 @@ export class RecordingService { this.systemEventService.on(DistributedEventType.RECORDING_ACTIVE, eventListener); }); + // Promise that starts the recording process const startRecordingPromise = (async (): Promise => { try { const options = this.generateCompositeOptionsFromRequest(room.config, configOverride); @@ -144,6 +147,16 @@ export class RecordingService { } catch (error) { if (isOperationCompleted) { this.logger.warn(`startRoomComposite failed after timeout: ${error}`); + + // Manually send the recording FAILED signal to OpenVidu Components for avoiding missing event + await this.frontendEventService.sendRecordingSignalToOpenViduComponents(roomId, { + recordingId, + roomId, + roomName: roomId, + status: MeetRecordingStatus.FAILED, + error: (error as Error).message + }); + throw errorRecordingStartTimeout(roomId); }