diff options
author | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-11-21 16:50:09 +0100 |
---|---|---|
committer | Elias Fleckenstein <eliasfleckenstein@web.de> | 2021-11-21 16:50:09 +0100 |
commit | d53a22a712fd272cac72353fceae366aa1792c5f (patch) | |
tree | 87d551b77ebe58797eee031ef6fbc7fcf9b9dd96 | |
parent | 40beef755f0c47691b5cd5a79e76fdd361320aa8 (diff) | |
download | lua_async-d53a22a712fd272cac72353fceae366aa1792c5f.tar.xz |
Subtract dtime from sleep time
-rw-r--r-- | util.lua | 8 |
1 files changed, 5 insertions, 3 deletions
@@ -39,11 +39,11 @@ function lua_async.run() local next = math.huge - for _, timeout in pairs(lua_async.timeouts.pool) + for _, timeout in pairs(lua_async.timeouts.pool) do next = math.min(next, timeout.time_left) end - for _, interval in pairs(lua_async.intervals.pool) + for _, interval in pairs(lua_async.intervals.pool) do next = math.min(next, interval.time_left) end @@ -51,6 +51,8 @@ function lua_async.run() return end - lua_async.socket.sleep(next) + if next > dtime then + lua_async.socket.sleep(next - dtime) + end end end |