[WIP] Modify mysql driver to reconnect after timeout #6
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This has been modified to use pooled connections to solve the timeout problem. Note that there is one significant problem with this PR, namely that it is broken and doesn't actually work.
Well, ok, it works if you set the connectionLimit of the pool to a very high number and make sure not to have too many hasMany relationships in your queries. However, it's possible for the connection pool to run out of connections while handling a single streaming query, since the readStream ends up calling the query() function several times for a given request in some cases. There's currently no way to tell the table.get() function to use a particular connection, so it happily (gleefully, even) gobbles up new connections with each request, eventually deadlocking everything and making me very sad.
I'm working on fixing this now, but I figured I'd updated this PR in the meantime to give you an idea of what things look like so far.