Fix issue where an exception is raised because we try to finish a thread that was never started (#4200)

This commit is contained in:
tofarr 2024-10-03 14:04:26 -06:00 committed by GitHub
parent 152f99c64f
commit ee6a1cf334
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -144,7 +144,9 @@ class AgentSession:
await self.security_analyzer.close()
self.loop.call_soon_threadsafe(self.loop.stop)
self.thread.join()
if self.thread:
# We may be closing an agent_session that was never actually started
self.thread.join()
self._closed = True