add comments

This commit is contained in:
0xfirefist 2024-05-10 14:38:17 +05:30
parent 0847b4c747
commit 30adb0f346
1 changed files with 11 additions and 2 deletions

View File

@ -57,6 +57,8 @@ use {
utoipa_swagger_ui::SwaggerUi, utoipa_swagger_ui::SwaggerUi,
}; };
let TRACK_DURATION = Duration::from_secs(10);
pub async fn run_api( pub async fn run_api(
socket_addr: SocketAddr, socket_addr: SocketAddr,
chains: HashMap<String, api::BlockchainState>, chains: HashMap<String, api::BlockchainState>,
@ -272,6 +274,7 @@ pub async fn run(opts: &RunOptions) -> Result<()> {
Ok(()) Ok(())
} }
/// tracks the balance of the given address for each chain in the given config periodically
pub async fn track_balance( pub async fn track_balance(
config: Config, config: Config,
address: Address, address: Address,
@ -303,9 +306,12 @@ pub async fn track_balance(
// comment on why is this ok // comment on why is this ok
.set(balance); .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( pub async fn track_collected_fee(
config: Config, config: Config,
provider_address: Address, provider_address: Address,
@ -338,10 +344,13 @@ pub async fn track_collected_fee(
}) })
.set(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( pub async fn track_hashchain(
config: Config, config: Config,
provider_address: Address, provider_address: Address,
@ -383,6 +392,6 @@ pub async fn track_hashchain(
.set(end_sequence_number as i64); .set(end_sequence_number as i64);
} }
time::sleep(Duration::from_secs(10)).await; time::sleep(TRACK_DURATION).await;
} }
} }