Skip to content

Commit 54f6fea

Browse files
Use tokio sleep instead of std sleep
1 parent fe32da1 commit 54f6fea

File tree

1 file changed

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

1 file changed

+5
-4
lines changed

aggregation_mode/proof_aggregator/src/backend/retry.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ use alloy::{
1717
rpc::types::TransactionReceipt,
1818
};
1919
use risc0_ethereum_contracts::encode_seal;
20-
use std::thread::sleep;
20+
use tokio::time::sleep;
2121

2222
#[derive(Debug)]
2323
pub enum RetryError<E> {
@@ -79,6 +79,9 @@ async fn wait_until_can_submit_aggregated_proof(
7979
// should be considered over a 24h period.
8080
let mut time_elapsed = Duration::from_secs(24 * 3600);
8181

82+
// Sleep for 3 minutes (15 blocks) before re-evaluating on each iteration
83+
let time_to_sleep = Duration::from_secs(180);
84+
8285
// Iterate until we can send the proof on-chain
8386
loop {
8487
// Fetch gas price from network
@@ -100,10 +103,8 @@ async fn wait_until_can_submit_aggregated_proof(
100103
info!("Skipping sending proof to ProofAggregationService contract due to budget/time constraints.");
101104
}
102105

103-
// Sleep for 3 minutes (15 blocks) before re-evaluating
104-
let time_to_sleep = Duration::from_secs(180);
105106
time_elapsed += time_to_sleep;
106-
sleep(time_to_sleep);
107+
sleep(time_to_sleep).await;
107108
}
108109

109110
Ok(())

0 commit comments

Comments
 (0)