# HG changeset patch # User Kim Alvefur # Date 1634824756 -7200 # Node ID 2bcd84123eba14a36eb33e2bc80ff2a6643745e1 # Parent e080d6aa0b3bde2e6e825f6f37bc212e1e227a2f 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 diff -r e080d6aa0b3b -r 2bcd84123eba net/server_epoll.lua --- a/net/server_epoll.lua Wed Oct 20 23:06:07 2021 +0200 +++ b/net/server_epoll.lua Thu Oct 21 15:59:16 2021 +0200 @@ -1033,7 +1033,7 @@ 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 @@ 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);