-
Notifications
You must be signed in to change notification settings - Fork 129
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
Auto reconnection to the database server is not triggered #257
Comments
I think we need to detect in "denodb" when connection is disconnected (ConnectionState ?), and reconnect it. I have do small fix in my local denodb version, but that "ugly" trick for reconnect the connection in case of error. The trick is: Log: @eveningkid: Hi have you any idea in your side ? Best regards |
Update:
But I think that just "ugly bypass" for avoid "Broken Pipe", "Connection timed out", "Connection Abort". What do you think about this issue ? @eveningkid Log:
|
Hey, Thank you so much for looking into this issue, really. Here's a few notes:
Now I wonder: do you think we could only catch this type of error? Is there maybe an error code we can look for and only then call for a reconnection? By the way, the simplest way for a new Let me know if you think we can specifically target this type of error inside our try/catch! :) Thanks again for helping on this! I'll try to be more reactive next time (you know how life is) |
Yes they have a lot of typed classes for determine errors: https://github.com/denodrivers/mysql/blob/6dcab807b9794376d818660761e2190524d3dcb0/src/constant/errors.ts I need to investigate more, this week I don't have much time to do it, I have a lot of work. Have a good day, and no problem dude ! It's a pleasure for me PS: Sorry for my bad english, it's not my primary lang |
I think we can indeed handle it on our side, it's not necessary to PR the MySQL driver. We could just go with the Then if it is a timeout error, call reconnect() {
this._connected = false;
return this._makeConnection();
} I guess we could have something like this for the query section: try {
...
} catch (error) {
if (error instanceof ResponseTimeoutError) {
await this.reconnect();
return this.query("pass the arguments from the current query call [I forgot the code signature /o/]");
}
} And no worries for the language, je suis français aussi :) |
This is what I have been doing since the beginning, I didn't think it was the cleanest way to do it 😄 I make PR ASAP ! Bonne journée |
Hello, I'm currently facing the same issue while syncing from MySQL. May I know if the fix (#269) will be applied soon? 😁 |
Hello,
I discovered a issue in MySQL connection when it is auto disconnected by the server (connection timeout, ect), the connection is not reconnected on the first request to server.
Auto reconnection is trigger after 2-3 requests to server.
If I have time to investigate I post some update in this ticket.
Best regards.
The text was updated successfully, but these errors were encountered: