Skip to content
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

fix: return error when custom getQueryResults() timeout has been exceeded #872

Merged
merged 12 commits into from
Nov 2, 2020

Conversation

steffnay
Copy link
Contributor

@steffnay steffnay commented Oct 12, 2020

It is currently possible to set options.timeoutMs when calling Job.getQueryResults(). The timeoutMs value is how long to wait for the query to complete, in milliseconds, before the request times out and returns. If the timeout is exceeded before the query completes, the API returns a response that includes jobComplete: false. However, due to the way that auto-pagination is handled, the client still continues to make getQueryResults() requests until the query completes.

This change updates Job.getQueryResults() to return an error when a custom timeout has been exceeded, rather than continuing to check for query results.

Job.createQueryJob() is also updated to allow job.configuration.jobTimeoutMs to be set.

Fixes #823 🦕

@steffnay steffnay requested a review from a team October 12, 2020 07:14
@steffnay steffnay requested a review from a team as a code owner October 12, 2020 07:14
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 12, 2020
@codecov
Copy link

codecov bot commented Oct 12, 2020

Codecov Report

Merging #872 into master will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #872   +/-   ##
=======================================
  Coverage   98.65%   98.65%           
=======================================
  Files           9        9           
  Lines        6967     6986   +19     
  Branches      418      422    +4     
=======================================
+ Hits         6873     6892   +19     
  Misses         94       94           
Impacted Files Coverage Δ
src/bigquery.ts 99.95% <100.00%> (+<0.01%) ⬆️
src/job.ts 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update be7c6e6...fd0b5ff. Read the comment docs.

src/job.ts Outdated Show resolved Hide resolved
src/job.ts Outdated Show resolved Hide resolved
@product-auto-label product-auto-label bot added the api: bigquery Issues related to the googleapis/nodejs-bigquery API. label Oct 14, 2020
@steffnay steffnay changed the title feat: return error when custom getQueryResults() timeout has been exceeded feat!: return error when custom getQueryResults() timeout has been exceeded Oct 14, 2020
src/bigquery.ts Outdated Show resolved Hide resolved
src/bigquery.ts Show resolved Hide resolved
@steffnay steffnay changed the title feat!: return error when custom getQueryResults() timeout has been exceeded fix: return error when custom getQueryResults() timeout has been exceeded Nov 2, 2020
@stephenplusplus stephenplusplus merged commit 96f939c into googleapis:master Nov 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: bigquery Issues related to the googleapis/nodejs-bigquery API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Timeout overriding does not works
2 participants