Skip to content

Commit

Permalink
Add support for setting an HTTP read timeout for BigQueryIO
Browse files Browse the repository at this point in the history
Shamelessly stolen from #7097
  • Loading branch information
jonathan-lemos committed Aug 8, 2024
1 parent a6de475 commit c0d566a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,14 @@ public interface BigQueryOptions
void setTempDatasetId(String value);

@Description(
"Timeout for HTTP requests to BigQuery service in milliseconds. Set to 0 to disable.")
"Timeout for HTTP read requests to BigQuery service in milliseconds. Set to 0 to disable.")
@Default.Integer(80 * 1000)
Integer getHTTPReadTimeout();

void setHTTPReadTimeout(Integer timeout);

@Description(
"Timeout for HTTP write requests to BigQuery service in milliseconds. Set to 0 to disable.")
@Default.Integer(900 * 1000)
Integer getHTTPWriteTimeout();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1584,6 +1584,7 @@ private static Bigquery.Builder newBigQueryClient(BigQueryOptions options) {
RetryHttpRequestInitializer httpRequestInitializer =
new RetryHttpRequestInitializer(ImmutableList.of(404));
httpRequestInitializer.setCustomErrors(createBigQueryClientCustomErrors());
httpRequestInitializer.setReadTimeout(options.getHTTPReadTimeout());
httpRequestInitializer.setWriteTimeout(options.getHTTPWriteTimeout());
ImmutableList.Builder<HttpRequestInitializer> initBuilder = ImmutableList.builder();
Credentials credential = options.getGcpCredential();
Expand Down

0 comments on commit c0d566a

Please sign in to comment.