Repository navigation
Conversation
Added connection retry to pooling configuration Closes #8014
|
According to comment by @eseliger, I assume the test case provided is good enough, even though codecov says otherwise. Please let me know if other test cases are necessary, examples will be appreciated. If not, it will be nice if we can merge this and get this on the next release. |
sushantdhiman
left a comment
There was a problem hiding this comment.
Sorry for not taking time to review original PR. I have some comments
- This is just a brute force attempt, 1 try didnt worked lets try 5 more time
- Real issue is still remains uncovered and there is no good testcase for that (is there?)
- We can solve issue partially by returning a specialised timeout error
SequelizeTimeoutErrorinstead of "Resource Request TImeout"
| this.pool = Pooling.createPool({ | ||
| create: () => this._connect(config).catch(err => err), | ||
| create: () => | ||
| retry(() => this._connect(config), { |
There was a problem hiding this comment.
This is not fixing any issue, we are just retrying 5 more time. Real issue is still there
There was a problem hiding this comment.
I agree, when I was reading the codes that's what I thought as well. However, the weird thing is, a few others mentioned that that PR managed to solve their timeout issue.
|
|
||
| return promise.then(() => { | ||
| return this.pool.acquire(options.priority, options.type, options.useMaster) | ||
| return new Promise((resolve, reject) => { |
There was a problem hiding this comment.
May be old code but this is no longer required, we now return error to pool and handle that when resolving connection
|
|
||
| connection.on('end', () => { | ||
| if (!connected) { | ||
| reject(new sequelizeErrors.ConnectionError('Error connecting to the database')); |
There was a problem hiding this comment.
This is something acceptable, but this is not the actual error. Its a timeout, which is already returned by pooling library? (It should be, as Resource Request Timeout). May be we should return a SequelizeTimeoutError or something
There was a problem hiding this comment.
I am happy to help to fix that ASAP.
Can I, somehow, edit the PR to do those changes?
Thanks :)
There was a problem hiding this comment.
@cladjules do you think it's possible for me to just transfer the entire repo to your name?
There was a problem hiding this comment.
@iamjoyce let me try to do a new PR and copy your code manually, there is not much to change. Thanks.
There was a problem hiding this comment.
@cladjules did you get a chance to look at this? Instead of copying the code you should be able to branch off @iamjoyce branch and then do a PR onto @iamjoyce or open a new PR directly on here.
There was a problem hiding this comment.
I will try to have a look this weekend. But quite busy. I will see what I can do and how I can reproduce...
|
Is this fix also relevant for postgreSQL? |
|
For me, reconnecting (MariaDB) now works with the official v4.31.2. |
|
Fixed by #8991 |
-- Edited on 18 Jan --Let me know if you are interested to take this over, I will transfer the repo to your name
Initially I thought the only thing stopping the PR from being merged was the outdated master branch codes, hence I created the PR. I don't think I understand the codes well enough to give my input on how this issue should be fixed, so it will probably be better for someone else to continue this.
-- End Edit --Pull Request check-list
npm run testornpm run test-DIALECTpass with this change (including linting)?Description of change
Purpose: Fixes MSSQL reconnect bug
Related Issue: #8014
Referenced from PR #8022