question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to correctly retry transactions

See original GitHub issue

Please note this is an issue tracker, not a support forum. For general questions, please use StackOverflow or Slack.

Why I’m asking here anyway:

grafik

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:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
dskvrcommented, Jun 1, 2018

How to retry without conditions?

{ retry: {} }

Documentation is incomplete, no examples.

0reactions
cirosantillicommented, Dec 2, 2021

How to retry without conditions?

{ retry: {} }

Documentation is incomplete, no examples.

Likely:

{ retry: { max: 999999999999, /.?/ } }

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found