aboutsummaryrefslogtreecommitdiffstats
path: root/net/server_epoll.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2021-10-21 15:59:16 +0200
committerKim Alvefur <zash@zash.se>2021-10-21 15:59:16 +0200
commit2408c299f020c5132edfc78a3566de83aa729f91 (patch)
tree9c06b3e2080f3263d9f7ebe828653dd3951f05ea /net/server_epoll.lua
parentaed2ada774adb4dda55266ec1b0620aa861d93e7 (diff)
downloadprosody-2408c299f020c5132edfc78a3566de83aa729f91.tar.gz
prosody-2408c299f020c5132edfc78a3566de83aa729f91.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
Diffstat (limited to 'net/server_epoll.lua')
-rw-r--r--net/server_epoll.lua6
1 files changed, 4 insertions, 2 deletions
diff --git a/net/server_epoll.lua b/net/server_epoll.lua
index e4fea5c1..0a0f89c5 100644
--- a/net/server_epoll.lua
+++ b/net/server_epoll.lua
@@ -1033,7 +1033,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
@@ -1046,7 +1046,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);