From d403db03358ec763176ec923498608866ceaf0a7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Fri, 31 May 2019 15:54:11 +0200 Subject: [PATCH] WIP: this code certainly was suspicious Small numbers would most likely get truncated to 0 when converted to an integer, leading to 0ms lua timer. --- daemon/lua/sandbox.lua.in | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/daemon/lua/sandbox.lua.in b/daemon/lua/sandbox.lua.in index b2b26c431..9f4d0ae55 100644 --- a/daemon/lua/sandbox.lua.in +++ b/daemon/lua/sandbox.lua.in @@ -484,10 +484,10 @@ if has_cqueues then -- Reschedule timeout or create new one local timeout = self.cq:timeout() if timeout then - -- Throttle timeouts to avoid too frequent wakeups - if timeout == 0 then timeout = 0.00001 end - -- Convert from seconds to duration + -- Convert from seconds to duration (milliseconds) timeout = timeout * sec + -- Don't allow 0ms timeout. + if timeout < 1 then timeout = 1 end if not self.next_timeout then self.next_timeout = event.after(timeout, self.on_step) else -- 2.47.2