Skip to content

Commit c0e70b1

Browse files
committed
close
1 parent b56e013 commit c0e70b1

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

plugins/openai/vision_agents/plugins/openai/rtc_manager.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,5 +294,11 @@ async def close(self) -> None:
294294
self._audio_to_openai_track.stop()
295295
if self._video_to_openai_track is not None:
296296
self._video_to_openai_track.stop()
297-
close_coro = self.pc.close()
298-
await asyncio.to_thread(lambda: asyncio.run(close_coro))
297+
298+
async def _safe_close():
299+
try:
300+
await self.pc.close()
301+
except Exception as e:
302+
logger.error(f"Error closing peer connection: {e}")
303+
304+
asyncio.create_task(_safe_close())

0 commit comments

Comments
 (0)