Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't externally close connection acquired from pool #533

Merged
merged 1 commit into from
Apr 14, 2021
Merged
Changes from all 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
11 changes: 4 additions & 7 deletions neo4j/io/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,6 @@ def __del__(self):
except OSError:
pass

def __enter__(self):
return self

def __exit__(self, exc_type, exc_value, traceback):
self.close()

def route(self, database=None, bookmarks=None):
""" Fetch a routing table from the server for the given
`database`. For Bolt 4.3 and above, this appends a ROUTE
Expand Down Expand Up @@ -675,10 +669,13 @@ def fetch_routing_info(self, address, database, bookmarks, timeout):
routing, or if routing support is broken or outdated
"""
try:
with self._acquire(address, timeout) as cx:
cx = self._acquire(address, timeout)
try:
routing_table = cx.route(
database or self.workspace_config.database, bookmarks
)
finally:
self.release(cx)
except BoltRoutingError as error:
# Connection was successful, but routing support is
# broken. This may indicate that the routing procedure
Expand Down