File tree Expand file tree Collapse file tree 2 files changed +30
-9
lines changed
Expand file tree Collapse file tree 2 files changed +30
-9
lines changed Original file line number Diff line number Diff line change @@ -152,13 +152,21 @@ async fn run_session(
152152 let llm_fut = llm:: chat ( tts_req_tx, chunks_tx, chat_session, text) ;
153153 let send_audio_fut = handle_tts_requests ( chunks_rx, session) ;
154154
155- let _ = tokio:: try_join!( llm_fut, send_audio_fut) ?;
156-
157- log:: info!(
158- "{}:{:x} session processing done for this input" ,
159- session. id,
160- session. request_id
161- ) ;
155+ let r = tokio:: try_join!( llm_fut, send_audio_fut) ;
156+ if let Err ( e) = r {
157+ log:: error!(
158+ "{}:{:x} error during llm or tts handling: {}" ,
159+ session. id,
160+ session. request_id,
161+ e
162+ ) ;
163+ } else {
164+ log:: info!(
165+ "{}:{:x} session processing done for this input" ,
166+ session. id,
167+ session. request_id
168+ ) ;
169+ }
162170
163171 session
164172 . cmd_tx
Original file line number Diff line number Diff line change @@ -176,9 +176,22 @@ impl TTSSessionPool {
176176 }
177177
178178 pub async fn run_loop ( & mut self , mut rx : TTSRequestRx ) -> anyhow:: Result < ( ) > {
179+ let mut sucess_workers = 0 ;
179180 for i in 0 ..self . workers {
180- let session = self . create_session ( ) . await ?;
181- tokio:: spawn ( Self :: run_session ( i as u128 , session, self . tx . clone ( ) ) ) ;
181+ match self . create_session ( ) . await {
182+ Ok ( session) => {
183+ tokio:: spawn ( Self :: run_session ( i as u128 , session, self . tx . clone ( ) ) ) ;
184+ sucess_workers += 1 ;
185+ }
186+ Err ( e) => {
187+ log:: error!( "create tts session[{i}] error: {}" , e) ;
188+ continue ;
189+ }
190+ } ;
191+ }
192+
193+ if sucess_workers == 0 {
194+ return Err ( anyhow:: anyhow!( "no available tts session worker" ) ) ;
182195 }
183196
184197 while let Some ( tts_req) = rx. recv ( ) . await {
You can’t perform that action at this time.
0 commit comments