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

Add more info about why lookup is in AwaitingDownload #5838

Merged
merged 5 commits into from
May 28, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Review comments
  • Loading branch information
dapplion committed May 24, 2024
commit 3ed145805c2e99906ba41dc7a2c4273b5c5ee367
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ impl<T: BeaconChainTypes> SingleBlockLookup<T> {
if awaiting_parent {
// Allow lookups awaiting for a parent to have zero peers. If when the parent
// resolve they still have zero peers the lookup will fail gracefully.
R::request_state_mut(self)
.get_state_mut()
.update_awaiting_download_status("no_peers_awaiting_parent");
return Ok(());
} else {
return Err(LookupRequestError::NoPeers);
Expand Down Expand Up @@ -380,9 +383,8 @@ impl<T: Clone> SingleLookupRequestState<T> {
/// Append metadata on why this request is in AwaitingDownload status. Very helpful to debug
/// stuck lookups. Not fallible as it's purely informational.
pub fn update_awaiting_download_status(&mut self, new_status: &'static str) {
match &mut self.state {
State::AwaitingDownload(status) => *status = new_status,
_ => {}
if let State::AwaitingDownload(status) = &mut self.state {
*status = new_status
}
}

Expand Down Expand Up @@ -411,7 +413,7 @@ impl<T: Clone> SingleLookupRequestState<T> {
});
}
self.failed_downloading = self.failed_downloading.saturating_add(1);
self.state = State::AwaitingDownload("retry");
self.state = State::AwaitingDownload("not started");
Ok(())
}
other => Err(LookupRequestError::BadState(format!(
Expand Down Expand Up @@ -475,7 +477,7 @@ impl<T: Clone> SingleLookupRequestState<T> {
State::Processing(result) => {
let peer_id = result.peer_id;
self.failed_processing = self.failed_processing.saturating_add(1);
self.state = State::AwaitingDownload("retry");
self.state = State::AwaitingDownload("not started");
Ok(peer_id)
}
other => Err(LookupRequestError::BadState(format!(
Expand Down
Loading