Skip to content

Commit

Permalink
chore(bq): update bigquery timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Jesus89 committed Nov 13, 2023
1 parent a754b36 commit 55e7b21
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
3 changes: 1 addition & 2 deletions clouds/bigquery/common/run-query.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ const BQ_PROJECT = process.env.BQ_PROJECT;
const client = new BigQuery({ projectId: `${BQ_PROJECT}` });

function runQuery (query) {
const query_options = { 'timeoutMs' : 120000 };
client.query(query, query_options);
client.query(query, { timeoutMs : 120000 });
}

const query = process.argv[2];
Expand Down
8 changes: 5 additions & 3 deletions clouds/bigquery/common/run-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,9 @@ const options = {
};
const bar = new cliProgress.SingleBar(options, cliProgress.Presets.shades_classic);

const client = new BigQuery({ projectId: `${BQ_PROJECT}`, timeout: 600000 });
const client = new BigQuery({ projectId: `${BQ_PROJECT}` });

async function runQueries (queries) {
const query_options = { 'timeoutMs' : 600000 };
const n = queries.length;
bar.start(n, 0);
for (let i = 0; i < n; i++) {
Expand All @@ -28,7 +27,10 @@ async function runQueries (queries) {
const result = results && results.reverse()[0]
sqlFunction = result && result.split('.').reverse()[0]

await client.query(query, query_options);
await client.query({
query,
jobTimeoutMs: 600000
});
bar.increment();
}
bar.stop(n);
Expand Down
2 changes: 1 addition & 1 deletion clouds/bigquery/common/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const BQ_DATASET = process.env.BQ_DATASET;
const client = new BigQuery({ projectId: `${BQ_PROJECT}` });

async function runQuery (query, options) {
options = Object.assign({}, { 'timeoutMs' : 120000 }, options);
options = Object.assign({}, { timeoutMs : 120000 }, options);
query = replaceBQPrefix(query);
const [rows] = await client.query(query, options);
return rows;
Expand Down

0 comments on commit 55e7b21

Please sign in to comment.