You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This PR adds an `InterruptHandle` that allows interrupting long-running
queries from another thread. Internally, this calls the
`duckdb_interrupt` function from the C API. The implementation is
inspired by [rusqlite][1].
It seems to get the job done, but a couple of thoughts:
1. Testing the interrupts is a bit tricky. I wasn't able to come up with
a deterministic approach, so I took inspiration from tests in other
client API: simply kick off an expensive query and interrupt it.
2. Unfortunately, the error code returned on interrupt is
`ErrorCode::Unknown`, so we have to resort to a match on the error
message. Works for now, but I'm wondering if there is a way to do this
in a cleaner way, or if the actual error code is simply not exposed from
the underlying API.
3. I'm not very familiar with the safety aspects of interfacing with the
C API, so a critical pair of eyes is welcome.
Previous attempt at adding this feature: #343.
[1]:
https://docs.rs/rusqlite/latest/rusqlite/struct.InterruptHandle.html
0 commit comments