Repository navigation
Add user interrupt check while waiting for query results to be ready. - #193
Conversation
… Allows safe interruption of long-running queries.
krlmlr
left a comment
There was a problem hiding this comment.
Thanks! The new code contains some libpq function calls I'm not familiar with, could we make this optional for now?
| person("Hadley", "Wickham", role = "aut"), | ||
| person("Jeroen", "Ooms", role = "aut"), | ||
| person("Kirill", "M\u00fcller", role = c("aut", "cre"), email = "[email protected]", comment = c(ORCID = "0000-0002-1416-3412")), | ||
| person("Mateusz", "\u017b\u00f3\u0142tak", role = c("ctb")), |
There was a problem hiding this comment.
In this project, we acknowledge in the NEWS.md file. I'll add an acknowledgment for all contributors to r-dbi repos to the upcoming DBI blog post too.
…t blocking moved to a separate method.
Of course we can. How would you prefer it to be done? By the way I added a link to the PG documentation in the code and an example of using |
|
Thanks. I think an argument to Can you please also resolve the conflicts? I can take care of the NEWS entry. |
|
Conflicts removed, adding |
|
I've been quite busy last few days, I'll provide the |
|
Any idea how to name the parameter? |
…f user interrupts should be checked while waiting for the first row of data to be available.
|
I added it as |
krlmlr
left a comment
There was a problem hiding this comment.
Thanks for your PR. I'll tweak myself.
|
Could you please double-check if the code still works as intended after my tweaks? In |
|
Seems to work fine :) Just a very minor remark - as you moved the instead of |
|
Thanks. The code is slightly more expressive in the current state, I'm keeping it. |
Sometimes user wants to terminate a query before a first row of results is available (e.g. it turned out that the query is too complicated and he wants to rewrite it instead of waiting for its completion). So far user interrupts where not checked until
PQgetResult()completion so the only option to achieve that was to terminate whole R session or to terminate the query on the database server.This pull requests adds user interrupts check between
PQsendQueryPrepared()andPQgetResult().It is done by waiting for data on the database connection socket with a timeout (1 second) using glibc's
select()and runningcheckUserInterrupt()if the timeout is hit.