From f001121d691f393751d9c51b42ee3781cbfbb292 Mon Sep 17 00:00:00 2001 From: Demmie <2e3s19@gmail.com> Date: Thu, 16 May 2024 22:21:39 -0400 Subject: [PATCH] Fix idle changed duration --- watchers/src/watchers/idle.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/watchers/src/watchers/idle.rs b/watchers/src/watchers/idle.rs index 4252f8e..7c8f89b 100644 --- a/watchers/src/watchers/idle.rs +++ b/watchers/src/watchers/idle.rs @@ -69,7 +69,11 @@ impl State { self.send_ping(now, client).await } - async fn send_ping(&mut self, now: DateTime, client: &Arc) -> anyhow::Result<()> { + async fn send_ping( + &mut self, + now: DateTime, + client: &Arc, + ) -> anyhow::Result<()> { if self.is_changed { let result = if self.is_idle { debug!("Reporting as changed to idle"); @@ -82,7 +86,7 @@ impl State { .ping( true, self.last_input_time + Duration::milliseconds(1), - Duration::zero(), + now - self.last_input_time, ) .await } else {