generated from recmo/rust-service-template
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
77 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
pub mod delete_identities; | ||
pub mod finalize_identities; | ||
pub mod insert_identities; | ||
pub mod monitor_queue; | ||
pub mod monitor_txs; | ||
pub mod process_identities; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
use std::sync::Arc; | ||
|
||
use tokio::time::{sleep, Duration}; | ||
|
||
use crate::task_monitor::{App, TaskMonitor}; | ||
|
||
// How often send metrics for idenity queue length | ||
const QUEUE_MONITORING_PERIOD: Duration = Duration::from_secs(1); | ||
|
||
pub async fn monitor_queue(app: Arc<App>) -> anyhow::Result<()> { | ||
loop { | ||
TaskMonitor::log_identities_queues(&app.database).await?; | ||
sleep(QUEUE_MONITORING_PERIOD).await; | ||
} | ||
} |