Merge pull request #1866 from gitbutlerapp/handle-fetch-errors

Handle fetch errors
This commit is contained in:
Nikita Galaiko 2023-11-30 18:42:32 +01:00 committed by GitHub
commit 0bed078a09
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 4 deletions

View File

@ -96,8 +96,13 @@ impl HandlerInner {
let fetch_result = match backoff::retry(policy, || {
gb_repo.fetch(user.as_ref()).map_err(|err| {
tracing::warn!(%project_id, ?err, will_retry=true, "failed to fetch gitbutler data" );
backoff::Error::transient(err)
match err {
gb_repository::RemoteError::Network => backoff::Error::permanent(err),
err => {
tracing::warn!(%project_id, ?err, will_retry = true, "failed to fetch project data");
backoff::Error::transient(err)
}
}
})
}) {
Ok(()) => projects::FetchResult::Fetched { timestamp: *now },

View File

@ -105,8 +105,13 @@ impl HandlerInner {
project_repository
.fetch(default_target.branch.remote(), &credentials)
.map_err(|err| {
tracing::warn!(%project_id, ?err, will_retry = true, "failed to fetch project data");
backoff::Error::transient(err)
match err {
RemoteError::Auth | RemoteError::Network => backoff::Error::permanent(err),
err => {
tracing::warn!(%project_id, ?err, will_retry = true, "failed to fetch project data");
backoff::Error::transient(err)
}
}
})
}) {
Ok(()) => projects::FetchResult::Fetched { timestamp: *now },