postgres-nio
postgres-nio copied to clipboard
Add a timeout to queries
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.
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. (?)
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...