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

Improve error logging on status changes #1068

Merged
merged 1 commit into from
Oct 24, 2023
Merged
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
16 changes: 8 additions & 8 deletions server/bleep/src/background/sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,6 @@ impl SyncHandle {
}
}
Err(err) => {
error!(?err, ?self.reporef, "failed to sync repository");
self.set_status(|_| SyncStatus::Error {
message: err.to_string(),
})
Expand Down Expand Up @@ -225,12 +224,9 @@ impl SyncHandle {
self.set_status(|_| SyncStatus::Done)
}
Err(SyncError::Cancelled) => self.set_status(|_| SyncStatus::Cancelled),
Err(err) => {
error!(?err, ?self.reporef, "failed to index repository");
self.set_status(|_| SyncStatus::Error {
message: err.to_string(),
})
}
Err(err) => self.set_status(|_| SyncStatus::Error {
message: err.to_string(),
}),
};

Ok(status.expect("failed to update repo status"))
Expand Down Expand Up @@ -446,7 +442,11 @@ impl SyncHandle {
repo.sync_status.clone()
})?;

debug!(?self.reporef, ?new_status, "new status");
if let SyncStatus::Error { ref message } = new_status {
error!(?self.reporef, err=?message, "indexing failed");
} else {
debug!(?self.reporef, ?new_status, "new status");
}
self.pipes.status(new_status.clone());
Some(new_status)
}
Expand Down