Skip to content

Commit

Permalink
src: stats: Add hub messages stats pub interface
Browse files Browse the repository at this point in the history
  • Loading branch information
joaoantoniocardoso committed Sep 17, 2024
1 parent 294c4e1 commit 5193155
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/stats/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::sync::{Arc, Mutex};

use accumulated::AccumulatedStatsInner;
use anyhow::Result;
use messages::HubMessagesStats;
use tokio::sync::{mpsc, oneshot};

use actor::StatsActor;
Expand Down Expand Up @@ -109,6 +110,16 @@ impl Stats {
response_rx.await?
}

pub async fn hub_messages_stats(&mut self) -> Result<HubMessagesStats> {
let (response_tx, response_rx) = oneshot::channel();
self.sender
.send(StatsCommand::GetHubMessagesStats {
response: response_tx,
})
.await?;
response_rx.await?
}

pub async fn set_period(&mut self, period: tokio::time::Duration) -> Result<()> {
let (response_tx, response_rx) = oneshot::channel();
self.sender
Expand Down

0 comments on commit 5193155

Please sign in to comment.