From: Vladimír Čunát Date: Fri, 31 May 2019 13:54:11 +0000 (+0200) Subject: WIP: this code certainly was suspicious X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fheads%2Flua-looping;p=thirdparty%2Fknot-resolver.git 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. --- 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