How to correctly retry transactions
See original GitHub issuePlease note this is an issue tracker, not a support forum. For general questions, please use StackOverflow or Slack.
Why I’m asking here anyway:
Now to the question: I’d like to know what to put into retry-as-promised’s match
option when retrying transactions. I want to catch everything worth retrying (deadlocks, connection errors and the like), and nothing not worth retrying (syntax errors, error responses from the DB like “Data too long for column” etc.). This is what I currently have (MySQL):
match: [ // Must match error signature (ala bluebird catch) to continue
Sequelize.ConnectionError,
Sequelize.ConnectionRefusedError,
Sequelize.ConnectionTimedOutError,
Sequelize.OptimisticLockError,
Sequelize.TimeoutError,
'SequelizeDatabaseError: Deadlock found when trying to get lock; try restarting transaction',
'ER_LOCK_DEADLOCK'
]
It would make me feel safer if anybody could assure me I’m not missing anything here.
Issue Analytics
- State:
- Created 6 years ago
- Reactions:1
- Comments:8 (2 by maintainers)
Top Results From Across the Web
Retrying Transactions - Solana Cookbook
A common pattern for manually retrying transactions involves temporarily storing the lastValidBlockHeight that comes from getLatestBlockhash ...
Read more >Application High Availability and Resiliency: Steps to Improve ...
The retry loop · Acquire a database connection · Begin a transaction · Attempt some changes · Commit the transaction · If an...
Read more >Monitoring and retrying shunted transactions - IBM
All shunted transactions are automatically retried by DFSMStvs every 15 minutes. If the retry is unsuccessful, another retry occurs after 15 minutes.
Read more >Transaction Retry Error Reference | CockroachDB Docs
A list of the transaction retry (serialization) errors emitted by CockroachDB, including likely causes and user actions for mitigation.
Read more >Implement SQL Server Transaction Retry Logic for failed ...
In programming when we talk about repeating an action, we talk about loops. And this is the way: we set a maximum retries...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
How to retry without conditions?
{ retry: {} }
Documentation is incomplete, no examples.
Likely:
Max is mandatory, retry never happens without: https://github.com/mickhansen/retry-as-promised/blob/5adc050ead38f513891c7afb3c94222dee33f739/index.js#L84 as
undefined <
n is always false.PostgreSQL workaround: https://stackoverflow.com/questions/68427796/sequelize-transaction-retry-doenst-work-as-expected/70204395#70204395