From e27412339c0d3ac8752b058ec51342c197a3000a Mon Sep 17 00:00:00 2001 From: Dreaded_X Date: Fri, 22 Aug 2025 03:04:08 +0200 Subject: [PATCH] Allow timeout to be a fraction of a second instead of always whole seconds --- automation_lib/src/helpers/timeout.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/automation_lib/src/helpers/timeout.rs b/automation_lib/src/helpers/timeout.rs index a33cbb1..bb3b456 100644 --- a/automation_lib/src/helpers/timeout.rs +++ b/automation_lib/src/helpers/timeout.rs @@ -29,14 +29,14 @@ impl mlua::UserData for Timeout { methods.add_async_method( "start", - |_lua, this, (timeout, callback): (u64, ActionCallback)| async move { + |_lua, this, (timeout, callback): (f32, ActionCallback)| async move { if let Some(handle) = this.state.write().await.handle.take() { handle.abort(); } debug!("Running timeout callback after {timeout}s"); - let timeout = Duration::from_secs(timeout); + let timeout = Duration::from_secs_f32(timeout); this.state.write().await.handle = Some(tokio::spawn({ async move {