Skip to content

Commit f8823e0

Browse files
Removal of the class ConnectionExpired
This is not used in the other drivers.
1 parent e7ef51c commit f8823e0

File tree

5 files changed

+16
-37
lines changed

5 files changed

+16
-37
lines changed

neo4j/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
from neo4j.addressing import Address
3838
from neo4j.api import *
3939
from neo4j.conf import Config, PoolConfig
40-
from neo4j.exceptions import ConnectionExpired, ServiceUnavailable
40+
from neo4j.exceptions import ServiceUnavailable
4141
from neo4j.meta import experimental, get_user_agent, version as __version__
4242

4343

neo4j/exceptions.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ class IncompleteCommitError(Exception):
4242
"""
4343

4444

45-
class ConnectionExpired(Exception):
46-
""" Raised when a connection is no longer available for the
47-
purpose it was originally acquired.
48-
"""
49-
50-
5145
class SecurityError(Exception):
5246
""" Raised when an action is denied due to security settings.
5347
"""

neo4j/io/__init__.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@
5555
ServiceUnavailable,
5656
AuthError,
5757
IncompleteCommitError,
58-
ConnectionExpired,
5958
DatabaseUnavailableError,
6059
NotALeaderError,
6160
ForbiddenOnReadOnlyDatabaseError,
@@ -378,7 +377,7 @@ def fetch_message(self):
378377
log.debug("[#%04X] S: FAILURE %r", self.local_port, summary_metadata)
379378
try:
380379
response.on_failure(summary_metadata or {})
381-
except (ConnectionExpired, ServiceUnavailable, DatabaseUnavailableError):
380+
except (ServiceUnavailable, DatabaseUnavailableError):
382381
if self.pool:
383382
self.pool.deactivate(self.unresolved_address),
384383
raise

neo4j/work/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121

2222
from neo4j.conf import Config
23-
from neo4j.exceptions import ConnectionExpired, ServiceUnavailable
23+
from neo4j.exceptions import ServiceUnavailable
2424

2525

2626
class WorkspaceConfig(Config):
@@ -78,7 +78,7 @@ def _disconnect(self, sync):
7878
try:
7979
self._connection.send_all()
8080
self._connection.fetch_all()
81-
except (WorkspaceError, ConnectionExpired, ServiceUnavailable):
81+
except (WorkspaceError, ServiceUnavailable):
8282
pass
8383
if self._connection:
8484
self._connection.in_use = False

neo4j/work/simple.py

Lines changed: 12 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
from neo4j.conf import DeprecatedAlias
3030
from neo4j.data import DataHydrator, DataDehydrator
3131
from neo4j.exceptions import (
32-
ConnectionExpired,
3332
CypherError,
3433
IncompleteCommitError,
3534
ServiceUnavailable,
@@ -124,8 +123,7 @@ def close(self):
124123
try:
125124
self._connection.send_all()
126125
self._connection.fetch_all()
127-
except (ConnectionExpired, CypherError, TransactionError,
128-
ServiceUnavailable, SessionExpired):
126+
except (CypherError, TransactionError, ServiceUnavailable, SessionExpired):
129127
pass
130128
finally:
131129
self._disconnect()
@@ -215,35 +213,26 @@ def done(summary_metadata):
215213
)
216214

217215
if not has_transaction:
218-
try:
219-
self._connection.send_all()
220-
self._connection.fetch_message()
221-
except ConnectionExpired as error:
222-
raise SessionExpired(*error.args)
216+
self._connection.send_all()
217+
self._connection.fetch_message()
223218

224219
return result
225220

226221
def send(self):
227222
""" Send all outstanding requests.
228223
"""
229224
if self._connection:
230-
try:
231-
self._connection.send_all()
232-
except ConnectionExpired as error:
233-
raise SessionExpired(*error.args)
225+
self._connection.send_all()
234226

235227
def fetch(self):
236228
""" Attempt to fetch at least one more record.
237229
238230
:returns: number of records fetched
239231
"""
240232
if self._connection:
241-
try:
242-
detail_count, _ = self._connection.fetch_message()
243-
except ConnectionExpired as error:
244-
raise SessionExpired(*error.args)
245-
else:
246-
return detail_count
233+
detail_count, _ = self._connection.fetch_message()
234+
return detail_count
235+
247236
return 0
248237

249238
def sync(self):
@@ -252,13 +241,10 @@ def sync(self):
252241
:returns: number of records fetched
253242
"""
254243
if self._connection:
255-
try:
256-
self._connection.send_all()
257-
detail_count, _ = self._connection.fetch_all()
258-
except ConnectionExpired as error:
259-
raise SessionExpired(*error.args)
260-
else:
261-
return detail_count
244+
self._connection.send_all()
245+
detail_count, _ = self._connection.fetch_all()
246+
return detail_count
247+
262248
return 0
263249

264250
def detach(self, result, sync=True):
@@ -392,7 +378,7 @@ def _run_transaction(self, access_mode, unit_of_work, *args, **kwargs):
392378
tx.success = True
393379
finally:
394380
tx.close()
395-
except (ServiceUnavailable, SessionExpired, ConnectionExpired) as error:
381+
except (ServiceUnavailable, SessionExpired) as error:
396382
errors.append(error)
397383
except TransientError as error:
398384
if is_retriable_transient_error(error):

0 commit comments

Comments
 (0)