Skip to content

Commit 8b05811

Browse files
Fix: sum the sleep time to the time elapsed
1 parent 007d2c5 commit 8b05811

File tree

1 file changed

+5
-4
lines changed
  • aggregation_mode/src/backend

1 file changed

+5
-4
lines changed

aggregation_mode/src/backend/mod.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,12 @@ impl ProofAggregator {
142142
);
143143

144144
// Iterate until we can send the proof on-chain
145-
let start_time = Instant::now();
145+
let mut time_elapsed: Duration =
146+
Instant::now().duration_since(start_time) + Duration::from_secs(24 * 3600);
146147

147148
loop {
148149
// We add 24 hours because the proof aggregator runs once a day, so the time elapsed
149150
// should be considered over a 24h period.
150-
let time_elapsed: Duration =
151-
Instant::now().duration_since(start_time) + Duration::from_secs(24 * 3600);
152151

153152
let gas_price = self.fetcher.get_gas_price().await.map_err(FetchingProofs)?;
154153

@@ -172,7 +171,9 @@ impl ProofAggregator {
172171
}
173172

174173
// Sleep for 3 minutes (15 blocks) before re-evaluating
175-
sleep(Duration::from_secs(180));
174+
let time_to_sleep = Duration::from_secs(180);
175+
time_elapsed += time_to_sleep;
176+
sleep(time_to_sleep);
176177
}
177178

178179
Ok(())

0 commit comments

Comments
 (0)