mauricio / postgresql-async

Async, Netty based, database drivers for PostgreSQL and MySQL written in Scala
Apache License 2.0
1.43k stars 222 forks source link

Docs for com.github.mauricio.async.db.pool.ConnectionPool regarding transactions still right? #237

Open rolandjohann opened 6 years ago

rolandjohann commented 6 years ago

Either I missunderstand the code or the docs of com.github.mauricio.async.db.pool.ConnectionPool are pointing into the wrong direction/is inconsistent regarding transactions and long running queries.

The downside of this is that you should not start transactions or any kind of long running process in this object as the object will be sent back to the pool right after executing a query. If you need to start transactions you will have to take an object from the pool, do it and then give it back manually.

Docs of com.github.mauricio.async.db.pool.ConnectionPool#inTransaction states

Picks one connection and executes an (asynchronous) function on it within a transaction block. If the function completes successfully, the transaction is committed, otherwise it is aborted. Either way, the connection is returned to the pool on completion.

This matches with the implementation which states: