postgres-nio icon indicating copy to clipboard operation
postgres-nio copied to clipboard

Add a timeout to queries

Open trasch opened this issue 3 years ago • 2 comments

Is your feature request related to a problem? Please describe. There is - as far as I can tell - currently no timeout for queries sent to the server. This would be helpful for the cases where you have some hard upper limit that a query should not exceed.

Describe the solution you'd like I would like to have an (optional) timeout parameter for all queries.

trasch avatar Mar 24 '22 16:03 trasch

Note: Usually it should be enough to use SET statement_timeout=X on the connection.

But there are cases where you might want to kill the connection because e.g. the query got stuck/is not cancellable. connection.close() doesn't seem to work but instead also blocks. (?)

trasch avatar Jun 03 '22 14:06 trasch

Hi @trasch would you be interested in adding this feature as well?

We would need to add a new query method that also accepts a NIODeadline. We then need to add the NIODeadline to the request object that we write to the channel...

fabianfett avatar Jun 03 '22 15:06 fabianfett