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

Apply the same fix as #54 to query_all #64

Merged
merged 1 commit into from
Sep 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/job.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,15 +101,22 @@ impl JobApi {
project_id,
job_id,
GetQueryResultsParameters {
page_token,
page_token: page_token.clone(),
max_results: page_size,
..Default::default()
},
)
.await?;

// Waiting for the job to be completed.
if !qr.job_complete.unwrap_or(false) {
tokio::time::sleep(tokio::time::Duration::from_millis(200)).await;
continue;
}

// Rows is present when the query finishes successfully.
yield Ok(qr.rows.expect("Rows are not present"));
// Rows is empty when query result is empty.
yield Ok(qr.rows.unwrap_or_default());

page_token = match qr.page_token {
None => break,
Expand Down