about summary refs log tree commit homepage
path: root/lib/PublicInbox/Syscall.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-04-25 21:31:44 +0000
committerEric Wong <e@80x24.org>2024-04-28 17:05:28 +0000
commit25c5108f2bdb29009ac986b7bde29ffca24e6e7a (patch)
treecaafc84388fe38a282e5d0f5dc87c9612a1fa178 /lib/PublicInbox/Syscall.pm
parentdba2370bd52ce5b550906c7fdb516af512d81bce (diff)
downloadpublic-inbox-25c5108f2bdb29009ac986b7bde29ffca24e6e7a.tar.gz
While existing callers are private (lei, *-index, -watch) are
private, we should not be blocking the event loop in
public-facing servers when we hit ETOOMANYREFS, ENOMEM, or
ENOBUFS.
Diffstat (limited to 'lib/PublicInbox/Syscall.pm')
-rw-r--r--lib/PublicInbox/Syscall.pm8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/PublicInbox/Syscall.pm b/lib/PublicInbox/Syscall.pm
index 99af5bf5..4cbe9623 100644
--- a/lib/PublicInbox/Syscall.pm
+++ b/lib/PublicInbox/Syscall.pm
@@ -467,8 +467,8 @@ if (defined($SYS_sendmsg) && defined($SYS_recvmsg)) {
 no warnings 'once';
 require PublicInbox::CmdIPC4;
 
-*send_cmd4 = sub ($$$$) {
-        my ($sock, $fds, undef, $flags) = @_;
+*send_cmd4 = sub ($$$$;$) {
+        my ($sock, $fds, undef, $flags, $tries) = @_;
         my $iov = pack('P'.TMPL_size_t,
                         $_[2] // NUL, length($_[2] // NUL) || 1);
         my $fd_space = scalar(@$fds) * SIZEOF_int;
@@ -487,10 +487,10 @@ require PublicInbox::CmdIPC4;
                         $msg_controllen,
                         0); # msg_flags
         my $s;
-        my $try = 0;
+        $tries //= 50;
         do {
                 $s = syscall($SYS_sendmsg, fileno($sock), $mh, $flags);
-        } while ($s < 0 && PublicInbox::CmdIPC4::sendmsg_retry($try));
+        } while ($s < 0 && PublicInbox::CmdIPC4::sendmsg_retry($tries));
         $s >= 0 ? $s : undef;
 };