Join GitHub today
GitHub is home to over 36 million developers working together to host and review code, manage projects, and build software together.Sign up
Switch to pessimistic SQL disconnect handling #1284
Previously we were using optimistic disconnect handling for the database connection pool: assume that all the connections are live and recycle them before a certain timeout just in case the server kills the connections after a certain period of inactivity. This approach reduced the frequency of "MySQL went away" errors, but it turns out that it didn't eliminate them.
As such, this change switches to pessimistic disconnect handling: before using a given connection, it is first tested for liveness by SQLAlchemy. This is implemented by passing