BinlogStream's Conn can be closed and returned to Pool #201
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.
After getting a connection from a pool, and using that connection to get a binlog stream, the pool cannot be disconnected. Why? Because the pool counts the connections as still alive (the pool never decreases the count, even after the binlog stream and its connection are disconnected and dropped).
As detailed here, I believe it's best to let the binlog connection remain part of the pool, and then returning the connection slot to the pool once the binlog stream goes out of scope and is dropped.
This PR makes it possible to close a binlog stream's connection, and if the stream belonged to a pool, it returns said connection back to the pool. Both disconnecting the stream, and the return of the connection are tested.
Importantly, this PR adds
BinlogStream::closeto the crate's public API (previously, the Binlog Stream's connection would just hang until it timed out and it was not possible to disconnect the stream's connection).