Skip to content

Commit

Permalink
Apply the same fix as #54 to query_all (#64)
Browse files Browse the repository at this point in the history
Fixes #61.
  • Loading branch information
LawnGnome committed Sep 27, 2023
1 parent 0bba73f commit b0bfa86
Showing 1 changed file with 9 additions and 2 deletions.
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

0 comments on commit b0bfa86

Please sign in to comment.