-
Notifications
You must be signed in to change notification settings - Fork 78
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
Add user interrupt check while waiting for query results to be ready. #193
Conversation
… Allows safe interruption of long-running queries.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! The new code contains some libpq function calls I'm not familiar with, could we make this optional for now?
DESCRIPTION
Outdated
Authors@R: c( | ||
person("Hadley", "Wickham", role = "aut"), | ||
person("Jeroen", "Ooms", role = "aut"), | ||
person("Kirill", "M\u00fcller", role = c("aut", "cre"), email = "krlmlr+r@mailbox.org", comment = c(ORCID = "0000-0002-1416-3412")), | ||
person("Mateusz", "\u017b\u00f3\u0142tak", role = c("ctb")), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Moved to NEWS.md in d6dcba9
…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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.