Skip to content

Discard transaction on disconnect #518

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

Merged
merged 11 commits into from
Apr 6, 2021

Conversation

robsdedude
Copy link
Member

A transaction is tied to the connection. If the connection dies, the transaction should die too. Previously, the session would try to rollback a transaction even if the transaction's connection died earlier.

To implement this, I decided to add an on_network_error callback to Result and Transaction. While at it, I also refactored all IOErrors to OSErrors. The latter one is the canonical form for this type of error since Python 3.3 (https://docs.python.org/3/whatsnew/3.3.html#pep-3151-reworking-the-os-and-io-exception-hierarchy)

Don't throw OSError on failed write, but BoltIncompleteCommitError or
ServiceUnavailable.
Since Python 3.3 IOError is an alias for OSError => canonicalize code.
@robsdedude robsdedude requested a review from technige March 25, 2021 16:24
When a network error occurs, the session should release the current connection
as it's dead and acquire a new one for the next transaction.
@robsdedude robsdedude requested a review from technige April 1, 2021 09:09
@robsdedude robsdedude merged commit fad6357 into neo4j:4.3 Apr 6, 2021
@robsdedude robsdedude deleted the discard-transaction-on-disconnect branch April 6, 2021 13:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants