mirror of
https://github.com/crewAIInc/crewAI.git
synced 2026-05-01 07:13:00 +00:00
fix: avoid event loop deadlock in snowflake pool lock
This commit is contained in:
@@ -166,12 +166,11 @@ class SnowflakeSearchTool(BaseTool):
|
|||||||
if self._connection_pool is None:
|
if self._connection_pool is None:
|
||||||
raise RuntimeError("Connection pool not initialized")
|
raise RuntimeError("Connection pool not initialized")
|
||||||
with self._pool_lock:
|
with self._pool_lock:
|
||||||
if not self._connection_pool:
|
if self._connection_pool:
|
||||||
conn = await asyncio.get_event_loop().run_in_executor(
|
return self._connection_pool.pop()
|
||||||
self._thread_pool, self._create_connection
|
return await asyncio.get_event_loop().run_in_executor(
|
||||||
)
|
self._thread_pool, self._create_connection
|
||||||
self._connection_pool.append(conn)
|
)
|
||||||
return self._connection_pool.pop()
|
|
||||||
|
|
||||||
def _create_connection(self) -> SnowflakeConnection:
|
def _create_connection(self) -> SnowflakeConnection:
|
||||||
"""Create a new Snowflake connection."""
|
"""Create a new Snowflake connection."""
|
||||||
|
|||||||
Reference in New Issue
Block a user