Skip to content

Commit 8bd3ebf

Browse files
committed
parser: inline measure_frame member variable
1 parent d2658c7 commit 8bd3ebf

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/parser/mod.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ struct WorkerStats {
1414
pub started_at: Instant,
1515
pub last_log: Instant,
1616
pub last_height: u64,
17-
pub measure_frame: Duration,
1817
}
1918

2019
impl WorkerStats {
@@ -23,7 +22,6 @@ impl WorkerStats {
2322
started_at: Instant::now(),
2423
last_log: Instant::now(),
2524
last_height: start_range,
26-
measure_frame: Duration::from_secs(10),
2725
}
2826
}
2927
}
@@ -92,10 +90,11 @@ impl BlockchainParser {
9290
}
9391

9492
fn print_progress(&mut self, height: u64) {
93+
let measure_frame = 10;
9594
let now = Instant::now();
96-
let blocks_speed = (height - self.stats.last_height) / self.stats.measure_frame.as_secs();
95+
let blocks_speed = (height - self.stats.last_height) / measure_frame;
9796

98-
if now - self.stats.last_log > self.stats.measure_frame {
97+
if now - self.stats.last_log > Duration::from_secs(measure_frame) {
9998
tracing::info!(target: "parser", "Status: {:7} Blocks processed. (remaining: {:7}, speed: {:5.2} blocks/s)",
10099
height, self.remaining(), blocks_speed);
101100
self.stats.last_log = now;

0 commit comments

Comments
 (0)