Skip to content

Commit

Permalink
increasing connection pool size, raising exception for connect errors
Browse files Browse the repository at this point in the history
  • Loading branch information
EvanDietzMorris committed Feb 6, 2025
1 parent d100a6d commit 5e093f6
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions PLATER/services/util/graph_adapter.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def __init__(self,
async def connect_to_neo4j(self, retries=0):
self.neo4j_driver = neo4j.AsyncGraphDatabase.driver(self.graph_db_uri,
auth=self.database_auth,
**{'telemetry_disabled': True})
**{'telemetry_disabled': True,
'max_connection_pool_size': 1000})
try:
await self.neo4j_driver.verify_connectivity()
except Exception as e: # currently the driver says it raises Exception, not something more specific
Expand All @@ -45,7 +46,8 @@ async def connect_to_neo4j(self, retries=0):
logger.error(f'Could not establish connection to neo4j, trying again... retry {retries + 1}')
await self.connect_to_neo4j(retries + 1)
else:
raise neo4j.exceptions.ServiceUnavailable('Connection to Neo4j could not be established.')
logger.error(f'Could not establish connection to neo4j, error: {e}')
raise e

@staticmethod
@unit_of_work(timeout=NEO4J_QUERY_TIMEOUT)
Expand Down

0 comments on commit 5e093f6

Please sign in to comment.