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

[QUESTION] Handle re-connect to server? #7

Open
ValiDrv opened this issue Jun 27, 2020 · 3 comments
Open

[QUESTION] Handle re-connect to server? #7

ValiDrv opened this issue Jun 27, 2020 · 3 comments
Labels
question Further information is requested

Comments

@ValiDrv
Copy link

ValiDrv commented Jun 27, 2020

Can this connection pool handle re-connecting

Ex:

- Connection to the mysql server established
- Commands can be sent correctly
- Network cable is unplugged/disconnected.
- Commands try to send, detect that the network disconnected, and tries to reconnect.
- Network cable is plugged back in/network goes up
- Pool eventually reconnects, and resumes operations correctly.
@hhxsv5
Copy link
Member

hhxsv5 commented Jun 28, 2020

Yes. The connection status will be checked when borrowing, and the disconnected connection will be removed from connection pool. See here.

@hhxsv5 hhxsv5 added the question Further information is requested label Jun 28, 2020
@ValiDrv
Copy link
Author

ValiDrv commented Jun 28, 2020

Are you sure that works when the network drops, and not just if the socket is connected? ex: swoole_event_addConnected

@kaerusdev
Copy link

This condition, which returns an throw, prevents the code from being executed further, and therefore the connection is not re-created.

throw $exception;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants