Skip to content

Commit

Permalink
Add support for setting an HTTP read timeout for BigQueryIO (#32118)
Browse files Browse the repository at this point in the history
Shamelessly stolen from #7097
  • Loading branch information
jonathan-lemos authored Aug 10, 2024
1 parent fc5a71d commit 4889969
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 4889969

Please sign in to comment.