mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-12-02 07:53:55 +03:00
Merge pull request #1866 from gitbutlerapp/handle-fetch-errors
Handle fetch errors
This commit is contained in:
commit
0bed078a09
@ -96,8 +96,13 @@ impl HandlerInner {
|
|||||||
|
|
||||||
let fetch_result = match backoff::retry(policy, || {
|
let fetch_result = match backoff::retry(policy, || {
|
||||||
gb_repo.fetch(user.as_ref()).map_err(|err| {
|
gb_repo.fetch(user.as_ref()).map_err(|err| {
|
||||||
tracing::warn!(%project_id, ?err, will_retry=true, "failed to fetch gitbutler data" );
|
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)
|
backoff::Error::transient(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}) {
|
}) {
|
||||||
Ok(()) => projects::FetchResult::Fetched { timestamp: *now },
|
Ok(()) => projects::FetchResult::Fetched { timestamp: *now },
|
||||||
|
@ -105,8 +105,13 @@ impl HandlerInner {
|
|||||||
project_repository
|
project_repository
|
||||||
.fetch(default_target.branch.remote(), &credentials)
|
.fetch(default_target.branch.remote(), &credentials)
|
||||||
.map_err(|err| {
|
.map_err(|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");
|
tracing::warn!(%project_id, ?err, will_retry = true, "failed to fetch project data");
|
||||||
backoff::Error::transient(err)
|
backoff::Error::transient(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}) {
|
}) {
|
||||||
Ok(()) => projects::FetchResult::Fetched { timestamp: *now },
|
Ok(()) => projects::FetchResult::Fetched { timestamp: *now },
|
||||||
|
Loading…
Reference in New Issue
Block a user