Skip to content

Commit

Permalink
Nexus bq: refactor run tracked (#1114)
Browse files Browse the repository at this point in the history
We close the tracker after getting the result set but if we error while
obtaining the result set, the token wouldn't get closed. This PR fixes
that.

---------

Co-authored-by: Philip Dubé <[email protected]>
  • Loading branch information
Amogh-Bharadwaj and serprex authored Jan 22, 2024
1 parent 8d4ed60 commit baf6d23
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions nexus/peer-bigquery/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,17 @@ impl BigQueryQueryExecutor {
.client
.job()
.query(&self.project_id, query_req)
.await
.map_err(|err| {
tracing::error!("error running query: {}", err);
PgWireError::ApiError(err.into())
})?;
.await;

token.end().await.map_err(|err| {
tracing::error!("error closing tracking token: {}", err);
PgWireError::ApiError(err.into())
})?;

Ok(result_set)
result_set.map_err(|err| {
tracing::error!("error running query: {}", err);
PgWireError::ApiError(err.into())
})
}
}

Expand Down

0 comments on commit baf6d23

Please sign in to comment.