Skip to content

Commit

Permalink
Merge pull request #14 from jhakulin/jhakulin/minor-fix-stop
Browse files Browse the repository at this point in the history
Clear consume event queue in stop
  • Loading branch information
jhakulin authored Nov 29, 2024
2 parents b3225d1 + dc3b185 commit 185fa7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/realtime_ai/aio/realtime_ai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ async def stop(self):
await self._consume_task
except asyncio.CancelledError:
logger.info("RealtimeAIClient: consume_events task cancelled.")

await self.service_manager.clear_event_queue()
except Exception as e:
logger.error(f"RealtimeAIClient: Error during client stop: {e}")

Expand Down
1 change: 1 addition & 0 deletions src/realtime_ai/realtime_ai_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def stop(self, timeout: float = 5.0):
logger.info("RealtimeAIClient: ThreadPoolExecutor shut down.")
self.executor = None

self.service_manager.clear_event_queue()
logger.info("RealtimeAIClient: Services stopped.")
except Exception as e:
logger.error(f"RealtimeAIClient: Error during client stop: {e}")
Expand Down

0 comments on commit 185fa7c

Please sign in to comment.