Closed pw374 closed 2 years ago
I will take a look whether Lwt.cancel
can be supported, but some options for the current version may be to set statement_timeout
on the connection before issuing the long-running statements.
I will take a look whether
Lwt.cancel
can be supported, but some options for the current version may be to setstatement_timeout
on the connection before issuing the long-running statements.
I think that trick will do for now. Thanks!
I tried to get Lwt.cancel
to work, but it seems tricky since Lwt.catch
does not intercept the timeout exception, probably because it is itself cancelled during the propagation. It's probably possible to make it work with the correct cancellation primitives around the Lwt.catch
, but I can see from the manual page that "cancelation has proved difficult to understand, explain, and maintain, so use of these functions is discouraged in new code." So, I think the better solution is to use the statement timeout.
I'm pushing a commit now which adds generic support for setting the statement timeout for a MariaDB and PostgreSQL connection. I couldn't find a way to do the same for SQLite3, so that's left as a no-op.
Thank you! 😊
Say there's a query that's taking too much time, and I want to kill it so that I can reuse that connection for other queries. Is it possible?
I thought naively that Lwt.cancel could do the job but it doesn't work and I end up with
Invalid concurrent usage of PostgreSQL connection detected.