qertoip / transaction_retry

Retries database transaction on deadlock and transaction serialization errors. Supports MySQL, PostgreSQL and SQLite.
MIT License
116 stars 42 forks source link

Feature request: add configurable Proc to run on retry #8

Open bduran82 opened 5 years ago

bduran82 commented 5 years ago

In our case we need to run custom code every time a transaction error is caught and retried in order to log differently the raised error.

For this reason we forked this project in here to implement a configurable lambda proc:

TransactionRetry.before_retry = ->(retry_num, error) { ... }

that runs when an TransactionIsolationConflict error is caught just before retrying.

In addition to this we upgraded some dependencies and make it possible to configure retry_on globally.

@qertoip Let us know if you want us to create a Pull Request for this changes to your gem.

giddie commented 4 years ago

Why not open a pull request?

bduran82 commented 4 years ago

Opened pull request #10