File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -85,13 +85,13 @@ async function updateHealthyEndpoints(): Promise<void> {
8585/**
8686 * Get the next healthy WebSocket endpoint in round-robin fashion
8787 */
88- function getNextEndpoint ( ) : string {
88+ function getNextEndpoint ( ) : string | null {
8989 if ( healthyEndpoints . length === 0 ) {
9090 healthyEndpoints = [ ...WS_TRANSCRIPTION_URLS ] ;
9191 }
9292
9393 if ( healthyEndpoints . length === 0 ) {
94- throw new Error ( 'No WebSocket transcription endpoints configured' ) ;
94+ return null ;
9595 }
9696
9797 const endpoint = healthyEndpoints [ currentIndex ] ;
@@ -108,7 +108,14 @@ async function handleGetRequest() {
108108 await updateHealthyEndpoints ( ) ;
109109
110110 const endpoint = getNextEndpoint ( ) ;
111-
111+
112+ if ( ! endpoint ) {
113+ return NextResponse . json (
114+ { error : 'No transcription endpoints configured' } ,
115+ { status : 503 }
116+ ) ;
117+ }
118+
112119 return NextResponse . json ( {
113120 url : endpoint ,
114121 healthyEndpoints : healthyEndpoints . length ,
You can’t perform that action at this time.
0 commit comments