stop_when_done
This commit is contained in:
@@ -163,8 +163,7 @@ class TTSService(AIService):
|
||||
|
||||
# Convenience function to send the audio for a sentence to the given queue
|
||||
async def say(self, sentence, queue: asyncio.Queue):
|
||||
async for audio_chunk in self.run_tts(sentence):
|
||||
await queue.put(QueueFrame(FrameType.AUDIO, audio_chunk))
|
||||
await self.run_to_queue(queue, [QueueFrame(FrameType.SENTENCE, sentence)])
|
||||
|
||||
|
||||
class ImageGenService(AIService):
|
||||
|
||||
@@ -209,6 +209,10 @@ class DailyTransportService(EventHandler):
|
||||
def wait_for_send_queue_to_empty(self):
|
||||
self.threadsafe_send_queue.join()
|
||||
|
||||
def stop_when_done(self):
|
||||
self.wait_for_send_queue_to_empty()
|
||||
self.stop()
|
||||
|
||||
async def run(self) -> None:
|
||||
self.configure_daily()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user