backend: Refactor recording timeout handling by extracting timeout registration into a separate method
This commit is contained in:
parent
74d1b542b6
commit
47350f1b10
@ -94,17 +94,10 @@ export class RecordingService {
|
|||||||
this.taskSchedulerService.cancelTask(`${roomId}_recording_timeout`);
|
this.taskSchedulerService.cancelTask(`${roomId}_recording_timeout`);
|
||||||
this.systemEventService.off(SystemEventType.RECORDING_ACTIVE, eventListener);
|
this.systemEventService.off(SystemEventType.RECORDING_ACTIVE, eventListener);
|
||||||
resolve(info as unknown as MeetRecordingInfo);
|
resolve(info as unknown as MeetRecordingInfo);
|
||||||
} else {
|
|
||||||
this.logger.error('Received recording active event with mismatched recording ID:', info);
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
this.taskSchedulerService.registerTask({
|
this.registerRecordingTimeout(roomId, recordingId, eventListener, reject);
|
||||||
name: `${roomId}_recording_timeout`,
|
|
||||||
type: 'timeout',
|
|
||||||
scheduleOrDelay: INTERNAL_CONFIG.RECORDING_STARTED_TIMEOUT,
|
|
||||||
callback: this.handleRecordingLockTimeout.bind(this, recordingId, roomId, eventListener, reject)
|
|
||||||
});
|
|
||||||
|
|
||||||
this.systemEventService.on(SystemEventType.RECORDING_ACTIVE, eventListener);
|
this.systemEventService.on(SystemEventType.RECORDING_ACTIVE, eventListener);
|
||||||
});
|
});
|
||||||
@ -609,6 +602,20 @@ export class RecordingService {
|
|||||||
await this.s3Service.saveObject(metadataPath, recordingInfo);
|
await this.s3Service.saveObject(metadataPath, recordingInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected registerRecordingTimeout(
|
||||||
|
roomId: string,
|
||||||
|
recordingId: string,
|
||||||
|
eventListener: (info: Record<string, unknown>) => void,
|
||||||
|
reject: (reason?: unknown) => void
|
||||||
|
): void {
|
||||||
|
this.taskSchedulerService.registerTask({
|
||||||
|
name: `${roomId}_recording_timeout`,
|
||||||
|
type: 'timeout',
|
||||||
|
scheduleOrDelay: INTERNAL_CONFIG.RECORDING_STARTED_TIMEOUT,
|
||||||
|
callback: this.handleRecordingLockTimeout.bind(this, recordingId, roomId, eventListener, reject)
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Cleans up orphaned recording locks in the system.
|
* Cleans up orphaned recording locks in the system.
|
||||||
*
|
*
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user