diff --git a/rust/kathy/src/kathy.rs b/rust/kathy/src/kathy.rs index 87aa78a29..721a86974 100644 --- a/rust/kathy/src/kathy.rs +++ b/rust/kathy/src/kathy.rs @@ -1,9 +1,8 @@ +use std::time::Duration; + use async_trait::async_trait; use ethers::core::types::H256; -use tokio::{ - task::JoinHandle, - time::{interval, Interval}, -}; +use tokio::{task::JoinHandle, time::sleep}; use rand::distributions::Alphanumeric; use rand::{thread_rng, Rng}; @@ -20,22 +19,18 @@ use tracing::info; use crate::settings::Settings; decl_agent!(Kathy { - interval_seconds: u64, + duration: u64, generator: ChatGenerator, }); impl Kathy { - pub fn new(interval_seconds: u64, generator: ChatGenerator, core: AgentCore) -> Self { + pub fn new(duration: u64, generator: ChatGenerator, core: AgentCore) -> Self { Self { - interval_seconds, + duration, generator, core, } } - - fn interval(&self) -> Interval { - interval(std::time::Duration::from_secs(self.interval_seconds)) - } } #[async_trait] @@ -52,9 +47,9 @@ impl OpticsAgent for Kathy { #[tracing::instrument] fn run(&self, _: &str) -> JoinHandle> { - let mut interval = self.interval(); let home = self.home(); let mut generator = self.generator.clone(); + let duration = Duration::from_secs(self.duration); tokio::spawn(async move { loop { if let Some(message) = generator.gen_chat() { @@ -65,7 +60,7 @@ impl OpticsAgent for Kathy { return Ok(()); } - interval.tick().await; + sleep(duration).await; } }) } diff --git a/rust/relayer/src/relayer.rs b/rust/relayer/src/relayer.rs index 8936be715..b1b981d57 100644 --- a/rust/relayer/src/relayer.rs +++ b/rust/relayer/src/relayer.rs @@ -74,7 +74,7 @@ impl UpdatePoller { // lock dropped here } else { info!( - "No update. Current root for replica {} is {:?}", + "No update. Current root for replica {} is {}", self.replica.name(), old_root );