Keep track of mysql statements to close #271
Merged
+103
−91
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 change refactors how we close uncached mysql statements. Instead of trying to issue the close request as part of the same SQL query, we now just keep track of whether a statement need to be closed or not and execute the closing as first operation in the next query execution. The large advantage of this approach is that we sidestep any async drop/cancelation related problems. The disadvantage is that we keep that statement open for a bit longer. I cannot see how we ever would have more than one statement in there per connection and we also keep the cached statements around, so this shouldn't cause any problems in practice.
Fix #269
Closes #270
cc @lukezbihlyj I think this is a better solution than polling the whole stream for all backends