Closed djc closed 4 years ago
You shouldn't need to return the connection by value in the error case, just have your method take a reference to the client.
That return is used conceptually to return the connection to the pool, though, so I think using ownership to ensure we don't do anything silly around that is preferable.
Connection pools traditionally continue to own the connections, and just lease out borrows via e.g. smart pointers. e.g. https://docs.rs/r2d2/0.8.6/r2d2/struct.PooledConnection.html
Yeah, we're currently discussing using that model in the PR. The bb8 maintainer thinks that it's easier to leak connections using smart pointers like that.
How would you leak a connection?
Not sure! If you want to discuss, maybe participate in https://github.com/khuey/bb8/pull/37.
In the process of updating bb8 for async/await, I'm running into some issues trying to test transaction support:
If I try to reproduce this problem in a simplified example, I don't see a similar problem:
Any thoughts on how to solve this/what the problem is here?