From 4c5f53261c05a228a723251d23be1fb74394bd8b Mon Sep 17 00:00:00 2001 From: Carlos Santos <4a.santos@gmail.com> Date: Thu, 10 Apr 2025 12:26:30 +0200 Subject: [PATCH] backend: Refactor webhook service to streamline recording started logic and rename saveRoomSecrets method --- backend/src/services/livekit-webhook.service.ts | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/backend/src/services/livekit-webhook.service.ts b/backend/src/services/livekit-webhook.service.ts index 221d3dc..ac719a2 100644 --- a/backend/src/services/livekit-webhook.service.ts +++ b/backend/src/services/livekit-webhook.service.ts @@ -198,10 +198,7 @@ export class LivekitWebhookService { // Send webhook notification switch (webhookAction) { case 'started': - tasks.push( - this.saveRoomSecretsIfNeeded(roomId), - this.openViduWebhookService.sendRecordingStartedWebhook(recordingInfo) - ); + tasks.push(this.openViduWebhookService.sendRecordingStartedWebhook(recordingInfo)); break; case 'updated': tasks.push(this.openViduWebhookService.sendRecordingUpdatedWebhook(recordingInfo)); @@ -219,6 +216,7 @@ export class LivekitWebhookService { break; case 'ended': tasks.push( + this.saveRoomSecretsFileIfNeeded(roomId), this.openViduWebhookService.sendRecordingEndedWebhook(recordingInfo), this.recordingService.releaseRoomRecordingActiveLock(roomId) ); @@ -243,7 +241,7 @@ export class LivekitWebhookService { * and moderator secrets, and saves them to an S3 bucket under the path * `${MEET_S3_RECORDINGS_PREFIX}/.metadata/${roomId}/secrets.json`. */ - protected async saveRoomSecretsIfNeeded(roomId: string): Promise { + protected async saveRoomSecretsFileIfNeeded(roomId: string): Promise { try { const filePath = `${MEET_S3_RECORDINGS_PREFIX}/.metadata/${roomId}/secrets.json`; const fileExists = await this.s3Service.exists(filePath);