From 26bc6cdfc1fbe61e5f245ff0e8881361918a65ae Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Thu, 13 Nov 2025 10:50:22 +0100 Subject: [PATCH] backend: improve documentation for stale recording evaluation logic --- meet-ce/backend/src/config/internal-config.ts | 2 +- meet-ce/backend/src/services/recording.service.ts | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/meet-ce/backend/src/config/internal-config.ts b/meet-ce/backend/src/config/internal-config.ts index 88e8670e..16ef7788 100644 --- a/meet-ce/backend/src/config/internal-config.ts +++ b/meet-ce/backend/src/config/internal-config.ts @@ -47,7 +47,7 @@ export const INTERNAL_CONFIG = { RECORDING_STARTED_TIMEOUT: '20s' as StringValue, // Timeout for recording start RECORDING_LOCK_GC_INTERVAL: '30m' as StringValue, // Garbage collection interval for recording locks RECORDING_ORPHANED_LOCK_GRACE_PERIOD: '1m' as StringValue, // Grace period for orphaned recording locks - RECORDING_STALE_CLEANUP_INTERVAL: '15m' as StringValue, // Cleanup interval for stale recordings + RECORDING_STALE_CLEANUP_INTERVAL: '15m' as StringValue, // Interval for cleaning up stale recordings that have not been updated within the allowed time RECORDING_STALE_AFTER: '5m' as StringValue, // Maximum allowed time since the last recording update before marking as stale CRON_JOB_MIN_LOCK_TTL: '59s' as StringValue, // Minimum TTL for cron job locks diff --git a/meet-ce/backend/src/services/recording.service.ts b/meet-ce/backend/src/services/recording.service.ts index 3b02d3b6..83b0ce93 100644 --- a/meet-ce/backend/src/services/recording.service.ts +++ b/meet-ce/backend/src/services/recording.service.ts @@ -962,11 +962,15 @@ export class RecordingService { } /** - * Evaluates a single recording and aborts it if it's considered stale. + * Evaluates whether a recording is stale and aborts it if necessary. + * A recording is considered stale if it has not been updated within the configured stale period + * and either the associated LiveKit room does not exist or has no publishers. + * If the recording is already aborted or has no updatedAt timestamp, it is kept as fresh. * - * @param egressInfo - The egress information for the recording to evaluate - * @returns {Promise} True if the recording was aborted, false if it's still fresh - * @protected + * @param egressInfo - The egress information containing details about the recording. + * @returns A promise that resolves to `true` if the recording was aborted, `false` otherwise. + * @throws Will throw an error if there is an issue retrieving recording status, checking room existence, + * or aborting the recording. */ protected async evaluateAndAbortStaleRecording(egressInfo: EgressInfo): Promise { const recordingId = RecordingHelper.extractRecordingIdFromEgress(egressInfo); @@ -1001,7 +1005,6 @@ export class RecordingService { } // Check if recording has not been updated recently - this.logger.debug(`Recording ${recordingId} last updated at ${new Date(updatedAt).toISOString()}`); if (!isRecordingStale) {