Skip to content
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

Need a callback upon reconnects #185

Open
Abscissa opened this issue May 7, 2018 · 1 comment
Open

Need a callback upon reconnects #185

Abscissa opened this issue May 7, 2018 · 1 comment

Comments

@Abscissa
Copy link

Abscissa commented May 7, 2018

As discussed in #176:

Currently, the MySQLPool's onNewConnection callback does not fire when an existing connection has been closed and re-connects. Given the callback's name is "onNewConnection", I think that is entirely appropriate.

However, there needs to also be a callback which gets triggered every time a connection reconnects. This is necessary to correctly handle many of MySQL's connection-specific configuration settings.

Unlike the existing onNewConnection, this onReconnect callback needs to be a member of Connection (although there should also be corresponding onReconnect in MySQLPool).

@Abscissa Abscissa added this to the v2.3.0 milestone May 7, 2018
@schveiguy
Copy link
Collaborator

This would solve the issue, but I would stress it needs to be settable in the pool, not just the connection.

Note that it's not entirely clear in what cases onNewConnection from the pool works. In my use case, I do not close any pool connections, I'm relying on the auto reconnect inside Connection to make sure it keeps working. So is onNewConnection called whenever a connection is established when locking a connection, or is it always called when I lock a connection? Or is it only called whenever a new connection object is created? It should be explained more in the docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants