Skip to content
This repository has been archived by the owner on May 14, 2024. It is now read-only.

Add recoverable decorator to retry non-query operations in case of lost connection #307

Open
wants to merge 2 commits into
base: 0.9
Choose a base branch
from

Conversation

onlywade
Copy link

@onlywade onlywade commented May 20, 2019

Similar to the @run decorator, this decorator causes a wrapped method to be retried in the case that the method throws an exception which appears to be due to a lost connection.

While the @run decorator is limited to wrapping methods with a particular signature (including query and bindings params), the @recoverable decorator is more generally applicable.

The @recoverable decorator can be applied to MySQLConnection.begin_transaction() in order to provide protection from stale connections in that context.

Note that a more direct approach does exist to this problem, as illustrated in #298. I would be most thankful if either approach is adopted!

Similar to the `@run` decorator, this decorator causes a wrapped
method to be retried in the case that the method throws an exception
which appears to be caused by a lost connection.

While the `@run` decorator is limited to wrapping methods with a
particular signature (including `query` and `bindings` params, the
`@recoverable` decorator is more generally applicable.
@onlywade onlywade force-pushed the recoverable_decorator_for_begin_transactionn branch from 5bab544 to 5824ff8 Compare May 20, 2019 19:17
In the event that the connection has been lost, causing an
exception when the connection attempts to set the autoconnect mode,
the operation should be retried.
@onlywade onlywade force-pushed the recoverable_decorator_for_begin_transactionn branch from 5824ff8 to 751bd45 Compare May 29, 2019 15:40
@onlywade
Copy link
Author

onlywade commented Jun 3, 2019

Hi @sdispater, any thoughts on this proposed fix? Please let me know if you have any concerns with the approach or anything. Thanks!

@xargsgrep
Copy link

@sdispater any updates on this? we would like to see this fix (or the other similar PR) in the next release.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants