-
Notifications
You must be signed in to change notification settings - Fork 348
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cancel the DB side query when doobie execution is cancelled #1922
Comments
Repeating my comment from Discord: a user can always opt-out of cancelation by adding |
Hello! Can I as a user customise transactor somehow from the outside to get the behaviour mentioned? Just not to wait for this feature to be implemented. |
@AlekseyKovalevsky In plain Java/JDBC, what needs to be called is PreparedStatement#cancel, but this has to be done from another thread (since JDBC operations are blocking). Therefore in order to do the same in Doobie I think we'll need to fork a fiber to cancel the preparedstatement when a cancellation is signaled from the caller of |
Actually this is a perfect usecase for the https://typelevel.org/cats-effect/docs/faq#how-do-i-cancel-or-timeout-delay-or-blocking |
If we run a long running query but then cancel it (e.g. application-side timeout or
IO.race
), we might want to cancel the DB side query by calling PreparedStatement#cancel(). (Simply callingclose()
which we currently do does not seem to cancel the query on the DB-side)e.g. https://discord.com/channels/632277896739946517/632727524434247691/1151507294664786021
Will need some more thought on whether this is universally desirable, and if not we'll need to make this configurable somehow (e.g. opt-in or opt-out)
The text was updated successfully, but these errors were encountered: