Fix: Solves the issue of Neo4j concurrent sessions
This commit is contained in:
parent
64424bd3a9
commit
14868ea932
2 changed files with 2 additions and 6 deletions
|
|
@ -18,7 +18,7 @@ class Neo4jAdapter(GraphDBInterface):
|
|||
graph_database_url: str,
|
||||
graph_database_username: str,
|
||||
graph_database_password: str,
|
||||
driver: Optional[Any] = None,
|
||||
driver: Optional[Any] = None
|
||||
):
|
||||
self.driver = driver or AsyncGraphDatabase.driver(
|
||||
graph_database_url,
|
||||
|
|
@ -26,9 +26,6 @@ class Neo4jAdapter(GraphDBInterface):
|
|||
max_connection_lifetime = 120
|
||||
)
|
||||
|
||||
async def close(self) -> None:
|
||||
await self.driver.close()
|
||||
|
||||
@asynccontextmanager
|
||||
async def get_session(self) -> AsyncSession:
|
||||
async with self.driver.session() as session:
|
||||
|
|
@ -43,7 +40,6 @@ class Neo4jAdapter(GraphDBInterface):
|
|||
async with self.get_session() as session:
|
||||
result = await session.run(query, parameters = params)
|
||||
data = await result.data()
|
||||
await self.close()
|
||||
return data
|
||||
except Neo4jError as error:
|
||||
logger.error("Neo4j query error: %s", error, exc_info = True)
|
||||
|
|
|
|||
|
|
@ -37,7 +37,7 @@ async def query_graph_connections(query: str, exploration_levels = 1) -> list[(s
|
|||
return []
|
||||
|
||||
node_connections_results = await asyncio.gather(
|
||||
*[graph_engine.get_connections(result.id) for result in relevant_results]
|
||||
*[graph_engine.get_connections(str(result.id)) for result in relevant_results]
|
||||
)
|
||||
|
||||
node_connections = []
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue