Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions neo4j/_async/io/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
defaultdict,
deque,
)
from contextlib import asynccontextmanager
from logging import getLogger
from random import choice

Expand Down Expand Up @@ -161,11 +160,10 @@ async def connection_creator():
connections = self.connections[address]
pool_size = (len(connections)
+ self.connections_reservations[address])
can_create_new_connection = (infinite_pool_size
or pool_size < max_pool_size)
self.connections_reservations[address] += 1
if can_create_new_connection:
return connection_creator
if infinite_pool_size or pool_size < max_pool_size:
# there's room for a new connection
self.connections_reservations[address] += 1
return connection_creator
return None

async def _acquire(self, address, deadline, liveness_check_timeout):
Expand Down
10 changes: 4 additions & 6 deletions neo4j/_sync/io/_pool.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
defaultdict,
deque,
)
from contextlib import contextmanager
from logging import getLogger
from random import choice

Expand Down Expand Up @@ -161,11 +160,10 @@ def connection_creator():
connections = self.connections[address]
pool_size = (len(connections)
+ self.connections_reservations[address])
can_create_new_connection = (infinite_pool_size
or pool_size < max_pool_size)
self.connections_reservations[address] += 1
if can_create_new_connection:
return connection_creator
if infinite_pool_size or pool_size < max_pool_size:
# there's room for a new connection
self.connections_reservations[address] += 1
return connection_creator
return None

def _acquire(self, address, deadline, liveness_check_timeout):
Expand Down