@@ -85,6 +85,7 @@ const PRESIGNED_EXPIRES_SECONDS = 6 * 60 * 60;
8585const MULTIPART_OUTPUT_PART_SIZE_BYTES = 64 * 1024 * 1024 ;
8686const SOURCE_COMMIT_BATCH_MAX_CHECKPOINTS = 32 ;
8787const SOURCE_COMMIT_BATCH_DURATION_MS = 15_000 ;
88+ const TRANSCRIPTION_QUEUE_MAX_ATTEMPTS = 12 ;
8889
8990function getErrorMessage ( error : unknown ) {
9091 return error instanceof Error ? error . message : String ( error ) ;
@@ -190,7 +191,7 @@ export async function finalizeDesktopRecordingWorkflow(
190191 if ( retained !== "retry" ) return { success : false , reason : retained } ;
191192 }
192193 }
193- for ( let attempt = 0 ; ; attempt ++ ) {
194+ for ( let attempt = 0 ; attempt < TRANSCRIPTION_QUEUE_MAX_ATTEMPTS ; attempt ++ ) {
194195 let queued : boolean ;
195196 try {
196197 queued = await queueFinalizedRecordingTranscription (
@@ -201,7 +202,9 @@ export async function finalizeDesktopRecordingWorkflow(
201202 queued = false ;
202203 }
203204 if ( queued ) break ;
204- await sleep ( Math . min ( 15_000 * 2 ** Math . min ( attempt , 5 ) , 300_000 ) ) ;
205+ if ( attempt + 1 < TRANSCRIPTION_QUEUE_MAX_ATTEMPTS ) {
206+ await sleep ( Math . min ( 15_000 * 2 ** Math . min ( attempt , 5 ) , 300_000 ) ) ;
207+ }
205208 }
206209 return mediaServerUnavailable
207210 ? { success : false , reason : "media-server-unconfigured" }
@@ -780,7 +783,7 @@ async function queueFinalizedRecordingTranscription(
780783 ) ;
781784 if ( result . success ) return true ;
782785 console . warn (
783- "[finalizeDesktopRecordingWorkflow] Transcription enqueue will retry " ,
786+ "[finalizeDesktopRecordingWorkflow] Transcription enqueue failed " ,
784787 { videoId, message : result . message } ,
785788 ) ;
786789 } catch ( error ) {
0 commit comments