diff options
author | Kim Alvefur <zash@zash.se> | 2021-10-21 15:59:16 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2021-10-21 15:59:16 +0200 |
commit | 577c21a2696f9a97d5e76779a8ab471c38b3ea5e (patch) | |
tree | 879ae3bf7e36b46093e57813c0feff0924a01edd | |
parent | 7ba9ee013c5505b855466b80fe93c0ec6d91343a (diff) | |
download | prosody-577c21a2696f9a97d5e76779a8ab471c38b3ea5e.tar.gz prosody-577c21a2696f9a97d5e76779a8ab471c38b3ea5e.zip |
net.server_epoll: Process all queued events from epoll before timers
Should call timers less frequently when many sockets are waiting for
processing. May help under heavy load.
Requested by Ge0rG
Backport of 2bcd84123eba requested by Roi
-rw-r--r-- | net/server_epoll.lua | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua index c47e1a70..eb292784 100644 --- a/net/server_epoll.lua +++ b/net/server_epoll.lua @@ -771,7 +771,7 @@ local function loop(once) repeat local t = runtimers(cfg.max_wait, cfg.min_wait); local fd, r, w = poll:wait(t); - if fd then + while fd do local conn = fds[fd]; if conn then if r then @@ -784,7 +784,9 @@ local function loop(once) log("debug", "Removing unknown fd %d", fd); poll:del(fd); end - elseif r ~= "timeout" and r ~= "signal" then + fd, r, w = poll:wait(0); + end + if r ~= "timeout" and r ~= "signal" then log("debug", "epoll_wait error: %s[%d]", r, w); end until once or (quitting and next(fds) == nil); |