prprprus / PyMySQLPool

PyMySQL-based database connection pool.
MIT License
60 stars 21 forks source link

MySQL Server has gone away #8

Closed kawamanza closed 5 years ago

kawamanza commented 5 years ago

The pooled connection might to be idle for a long time, and the server may disconnect or kill the process for any reason. In this case, the broker should check the connection before deliver it to the requester. It would be nice if PyMySQLPool do a ping() after some amount of time to force reconnection.

prprprus commented 5 years ago

Hi, @kawamanza

Thanks for your awesome advice, I think you are right, are you interested in submitting a pr 😏?

kawamanza commented 5 years ago

Hi @prprprus,

Great. I did a monkey-patch on a project that I am using your lib just to workaround this issue. I'll try to reply the code to a PR for your review.