Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

yield a different warning when the cache upload times out #8079

Merged
merged 1 commit into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 18 additions & 4 deletions crates/turborepo-cache/src/http.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ impl HTTPCache {
.map(|signer| signer.generate_tag(hash.as_bytes(), &artifact_body))
.transpose()?;

self.client
tracing::debug!("uploading {}", hash);

match self
.client
.put_artifact(
hash,
&artifact_body,
Expand All @@ -85,9 +88,20 @@ impl HTTPCache {
self.api_auth.team_id.as_deref(),
self.api_auth.team_slug.as_deref(),
)
.await?;

Ok(())
.await
{
Ok(_) => {
tracing::debug!("uploaded {}", hash);
Ok(())
}
Err(turborepo_api_client::Error::ReqwestError(e)) if e.is_timeout() => {
Err(CacheError::TimeoutError(hash.to_string()))
}
Err(turborepo_api_client::Error::ReqwestError(e)) if e.is_connect() => {
Err(CacheError::ConnectError)
}
Err(e) => Err(e.into()),
}
}

#[tracing::instrument(skip_all)]
Expand Down
4 changes: 4 additions & 0 deletions crates/turborepo-cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ pub enum CacheError {
InvalidFilePath(String, #[backtrace] Backtrace),
#[error("failed to contact remote cache: {0}")]
ApiClientError(Box<turborepo_api_client::Error>, #[backtrace] Backtrace),
#[error("the cache artifact for {0} was too large to upload within the timeout")]
TimeoutError(String),
#[error("could not connect to the cache")]
ConnectError,
#[error("signing artifact failed: {0}")]
SignatureError(#[from] SignatureError, #[backtrace] Backtrace),
#[error("invalid duration")]
Expand Down
Loading