]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
lei: increase umask timeout
authorEric Wong <e@80x24.org>
Fri, 30 Aug 2024 19:05:15 +0000 (19:05 +0000)
committerEric Wong <e@80x24.org>
Sat, 31 Aug 2024 01:10:13 +0000 (01:10 +0000)
On slow or overloaded systems, 2 seconds may not be sufficient
time to wait for a lei client to respond to the umask request
from lei-daemon.  Use 60s to be consistent with the FD transfer
in the general case.

While we're at it, consistently use poll_in() now that it exists
since it's a better API than vec() + select() and will give
consistent performance regardless of the FD value.

lib/PublicInbox/LEI.pm

index 637cc8b10a01ed4bff56236c6a9c03aa3444f8d9..6d072b95dffbfc180e18735c1ee0045caa52e31e 100644 (file)
@@ -1155,8 +1155,7 @@ sub accept_dispatch { # Listener {post_accept} callback
        my ($sock) = @_; # ignore other
        $sock->autoflush(1);
        my $self = bless { sock => $sock }, __PACKAGE__;
-       vec(my $rvec = '', fileno($sock), 1) = 1;
-       select($rvec, undef, undef, 60) or
+       poll_in $sock, 60_000 or
                return send_gently $sock, 'timed out waiting to recv FDs';
        # (4096 * 33) >MAX_ARG_STRLEN
        my @fds = $PublicInbox::IPC::recv_cmd->($sock, my $buf, 4096 * 33) or
@@ -1589,8 +1588,7 @@ sub request_umask { # assumes client is trusted and fast
        my ($v, $r, $u);
        do { # n.b. poll_in returns -1 on EINTR
                vec($v = '', fileno($s), 1) = 1;
-               $r = poll_in($s, 2) or
-                       die 'timeout waiting for umask';
+               $r = poll_in $s, 60_000 or die 'timeout waiting for umask';
        } while ($r < 0 && $! == EINTR);
        do {
                $r = recv $s, $v, 5, 0;