From 30adb0f346e8e8e067bc14c40f8d7bbcb44a30d3 Mon Sep 17 00:00:00 2001 From: 0xfirefist Date: Fri, 10 May 2024 14:38:17 +0530 Subject: [PATCH] add comments --- apps/fortuna/src/command/run.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/fortuna/src/command/run.rs b/apps/fortuna/src/command/run.rs index c60e6e36..7e81de45 100644 --- a/apps/fortuna/src/command/run.rs +++ b/apps/fortuna/src/command/run.rs @@ -57,6 +57,8 @@ use { utoipa_swagger_ui::SwaggerUi, }; +let TRACK_DURATION = Duration::from_secs(10); + pub async fn run_api( socket_addr: SocketAddr, chains: HashMap, @@ -272,6 +274,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> { Ok(()) } +/// tracks the balance of the given address for each chain in the given config periodically pub async fn track_balance( config: Config, address: Address, @@ -303,9 +306,12 @@ pub async fn track_balance( // comment on why is this ok .set(balance); } + + time::sleep(TRACK_DURATION).await; } } +/// tracks the collected fees of the given address for each chain in the given config periodically pub async fn track_collected_fee( config: Config, provider_address: Address, @@ -338,10 +344,13 @@ pub async fn track_collected_fee( }) .set(collected_fee); } + + time::sleep(TRACK_DURATION).await; } } - +/// tracks the current sequence number and end sequence number of the given provider address for +/// each chain in the given config periodically pub async fn track_hashchain( config: Config, provider_address: Address, @@ -383,6 +392,6 @@ pub async fn track_hashchain( .set(end_sequence_number as i64); } - time::sleep(Duration::from_secs(10)).await; + time::sleep(TRACK_DURATION).await; } }