| 226 | log("info", f"Global TTS process started (pid: {self.tts_process.pid})") |
| 227 | |
| 228 | def stop_tts_process(self): |
| 229 | if self.tts_process and self.tts_process.is_alive(): |
| 230 | self.tts_control_queue.put(('stop', None)) |
| 231 | self.tts_process.join(timeout=5.0) |
| 232 | if self.tts_process.is_alive(): |
| 233 | log("warning", "TTS process did not stop in time, terminating...") |
| 234 | self.tts_process.terminate() |
| 235 | log("info", "Global TTS process stopped") |
| 236 | |
| 237 | async def handle_chat(self, request): |
| 238 | # Set heartbeat interval to 30 seconds and timeout to 60 seconds to prevent connections from being disconnected by intermediate proxies/firewalls |