Skip to content
This repository has been archived by the owner on Jul 21, 2023. It is now read-only.

Commit

Permalink
Merge pull request #419 from abetterinternet/timg/retry-gcs
Browse files Browse the repository at this point in the history
facilitator: GCS client timeouts
  • Loading branch information
tgeoghegan authored Feb 17, 2021
2 parents 441af9f + ddec30b commit f81d354
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions facilitator/src/transport/gcs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use log::info;
use std::{
io,
io::{Read, Write},
time::Duration,
};

const STORAGE_API_BASE_URL: &str = "https://storage.googleapis.com";
Expand Down Expand Up @@ -75,8 +76,7 @@ impl Transport for GCSTransport {
&format!("Bearer {}", self.oauth_token_provider.ensure_oauth_token()?),
)
// By default, ureq will wait forever to connect or read
.timeout_connect(10_000) // ten seconds
.timeout_read(10_000) // ten seconds
.timeout(Duration::from_secs(120)) // two minutes for connect + read + write
.call();
if response.error() {
return Err(anyhow!(
Expand Down Expand Up @@ -172,9 +172,7 @@ impl StreamingTransferWriter {
.query("uploadType", "resumable")
.query("name", &encoded_object)
// By default, ureq will wait forever to connect or read
.timeout_connect(10_000) // ten seconds
.timeout_read(120_000) // two minutes
.timeout_write(120_000) // two minutes
.timeout(Duration::from_secs(120)) // two minutes for connect + read + write
.send_bytes(&[]);
if http_response.error() {
return Err(anyhow!("uploading to gs://{}: {:?}", bucket, http_response));
Expand Down

0 comments on commit f81d354

Please sign in to comment.