mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 19:09:54 +00:00
fix(node-core): log stage progress only after the first stage run (#7319)
This commit is contained in:
@ -87,6 +87,12 @@ impl<DB> NodeState<DB> {
|
||||
_ => Eta::default(),
|
||||
},
|
||||
checkpoint,
|
||||
entities_checkpoint: match &self.current_stage {
|
||||
Some(current_stage) if current_stage.stage_id == stage_id => {
|
||||
current_stage.entities_checkpoint
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
target,
|
||||
};
|
||||
|
||||
@ -111,6 +117,12 @@ impl<DB> NodeState<DB> {
|
||||
_ => Eta::default(),
|
||||
},
|
||||
checkpoint,
|
||||
entities_checkpoint: match &self.current_stage {
|
||||
Some(current_stage) if current_stage.stage_id == stage_id => {
|
||||
current_stage.entities_checkpoint
|
||||
}
|
||||
_ => None,
|
||||
},
|
||||
target,
|
||||
};
|
||||
|
||||
@ -146,11 +158,13 @@ impl<DB> NodeState<DB> {
|
||||
|
||||
if let Some(current_stage) = self.current_stage.as_mut() {
|
||||
current_stage.checkpoint = checkpoint;
|
||||
current_stage.entities_checkpoint = checkpoint.entities();
|
||||
current_stage.eta.update(stage_id, checkpoint);
|
||||
|
||||
let target = OptionalField(current_stage.target);
|
||||
let stage_progress =
|
||||
checkpoint.entities().and_then(|entities| entities.fmt_percentage());
|
||||
let stage_progress = current_stage
|
||||
.entities_checkpoint
|
||||
.and_then(|entities| entities.fmt_percentage());
|
||||
let stage_eta = current_stage.eta.fmt_for_stage(stage_id);
|
||||
|
||||
let message =
|
||||
@ -346,6 +360,10 @@ struct CurrentStage {
|
||||
stage_id: StageId,
|
||||
eta: Eta,
|
||||
checkpoint: StageCheckpoint,
|
||||
/// The entities checkpoint for reporting the progress. If `None`, then the progress is not
|
||||
/// available, probably because the stage didn't finish running and didn't update its
|
||||
/// checkpoint yet.
|
||||
entities_checkpoint: Option<EntitiesCheckpoint>,
|
||||
target: Option<BlockNumber>,
|
||||
}
|
||||
|
||||
@ -446,11 +464,11 @@ where
|
||||
while this.info_interval.poll_tick(cx).is_ready() {
|
||||
let freelist = OptionalField(this.state.freelist());
|
||||
|
||||
if let Some(CurrentStage { stage_id, eta, checkpoint, target }) =
|
||||
if let Some(CurrentStage { stage_id, eta, checkpoint, entities_checkpoint, target }) =
|
||||
&this.state.current_stage
|
||||
{
|
||||
let stage_progress =
|
||||
checkpoint.entities().and_then(|entities| entities.fmt_percentage());
|
||||
entities_checkpoint.and_then(|entities| entities.fmt_percentage());
|
||||
let stage_eta = eta.fmt_for_stage(*stage_id);
|
||||
|
||||
match (stage_progress, stage_eta) {
|
||||
|
||||
Reference in New Issue
Block a user