-
Notifications
You must be signed in to change notification settings - Fork 25
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
Retry is not working when there is an error "TimeoutError: retry timed out" #23
Comments
The timeout error generated by the library is outside the retry logic loop: https://github.com/mickhansen/retry-as-promised/blob/master/index.js#L66 |
Thank you for the quick response. I got it now. So is there any option to retry that kind of error? |
Not at this time, needs to be fixed. |
Does this not completely break the purpose? Am I missing something? Attempting to use this in sequelize and this fails without retrying: const retryOptions: RetryOptions = {
match : [ TimeoutError ],
report : console.log,
max : 5,
timeout : 1 * 1000, // 1 second timeout
backoffBase : 10 * 1000,
backoffExponent : 1
}
const options: QueryOptions = { retry: retryOptions }
//takes ~5 seconds on my CPU
await sequelize.queryRaw( `WITH RECURSIVE r(i) AS (
VALUES(0)
UNION ALL
SELECT i FROM r
LIMIT 10000000
)
SELECT i FROM r WHERE i = 1;`, options ) |
@blipk Correct, as the code is written now, if the timeout is hit it does not trigger retries. I can't recall if that was intended or not, but in retrospect it does not sound ideal. |
Thanks for the quick response and confirmation @mickhansen Are you intending to work on this? Would you accept a PR? Any preference on how you would want it implemented? |
@blipk I imagine it would be as simple as converting the current setup to use |
Thanks @mickhansen My concern is that Sequelize uses this library for its underlying retry logic I've raised an issue there and will see what they say - sequelize/sequelize#17459 |
I used "the retry-as-promised" in my Sequelize node js server to connect the database.
I added match as
match: [ Sequelize.ConnectionError, Sequelize.ConnectionRefusedError, Sequelize.ConnectionTimedOutError, Sequelize.OptimisticLockError, Sequelize.TimeoutError, "TimeoutError", "retryTimeout", "TimeoutError: retry timed out", // 'SequelizeDatabaseError: Deadlock found when trying to get lock; try restarting transaction', // 'ER_LOCK_DEADLOCK', // 'SQL_BUSY', /SequelizeConnectionError/, /SequelizeConnectionRefusedError/, /SequelizeConnectionTimedOutError/, /SequelizeHostNotFoundError/, /SequelizeHostNotReachableError/, /SequelizeInvalidConnectionError/, /TimeoutError/ ]
though I added the "TimeoutError", its not retrying when happened with that error.
The text was updated successfully, but these errors were encountered: