diff options
author | Eric Wong <e@80x24.org> | 2021-09-21 09:29:44 +0000 |
---|---|---|
committer | Eric Wong <e@80x24.org> | 2021-09-21 19:18:36 +0000 |
commit | 5c7d3f916da9a9c93419282e943a7d45c53b9c86 (patch) | |
tree | 6a32a05d58629fa19dae5a160144037f6a0500b9 /script/lei | |
parent | 1411a6e0ca36d6eda89a2f2f4e937fec3cad2030 (diff) | |
download | public-inbox-5c7d3f916da9a9c93419282e943a7d45c53b9c86.tar.gz |
Sometimes it's useful to pause an expensive query or refresh-mail-sync to do something else. While lei-daemon and lei/store can't be paused since they're shared across clients, per-invocation WQ workers can be paused safely using the unblockable SIGSTOP. While we're at it, drop the ETOOMANYREFS hint since it hasn't been a problem since we drastically reduced FD passing early in development.
Diffstat (limited to 'script/lei')
-rwxr-xr-x | script/lei | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -106,11 +106,10 @@ open my $dh, '<', '.' or die "open(.) $!"; my $buf = join("\0", scalar(@ARGV), @ARGV); while (my ($k, $v) = each %ENV) { $buf .= "\0$k=$v" } $buf .= "\0\0"; -my $n = $send_cmd->($sock, [0, 1, 2, fileno($dh)], $buf, MSG_EOR); -if (!$n) { - die "sendmsg: $! (check RLIMIT_NOFILE)\n" if $!{ETOOMANYREFS}; - die "sendmsg: $!\n"; -} +$send_cmd->($sock, [0, 1, 2, fileno($dh)], $buf, MSG_EOR) or die "sendmsg: $!"; +$SIG{TSTP} = sub { $send_cmd->($sock, [], 'STOP', MSG_EOR); kill 'STOP', $$ }; +$SIG{CONT} = sub { $send_cmd->($sock, [], 'CONT', MSG_EOR) }; + my $x_it_code = 0; while (1) { my (@fds) = $recv_cmd->($sock, my $buf, 4096 * 33); |