This change prevents lingering shard and git-fast-import
processes from remaining after interrupted "lei import" (and
similar). It also reduces the likelyhood of data-loss in case
of subsequent abnormal termination of the daemon.
I think this is the least surprising way to handle users
prematurely aborting imports or other similar operations which
write to lei/store and will result in reduced bandwidth waste
for users with intermittent connections. This is because the
lei/store processes may be shared by parallel "lei import"
callers, and commits done by any "lei import" caller will
inevitably trigger writes for all of them.
for my $wq (grep(defined, @$lei{qw(ikw pmd)})) { # auxiliary WQs
$wq->wq_close;
}
for my $wq (grep(defined, @$lei{qw(ikw pmd)})) { # auxiliary WQs
$wq->wq_close;
}
+ $wq1->{lei_sock} = $lei->{sock} if $wq1;
}
sub wq_eof { # EOF callback for main daemon
}
sub wq_eof { # EOF callback for main daemon
+ my ($lei, $wq_fld) = @_;
local $current_lei = $lei;
local $current_lei = $lei;
- delete $lei->{wq1} // return $lei->fail; # already failed
+ my $wq = delete $lei->{$wq_fld // 'wq1'};
+ $lei->sto_done_request($wq);
+ $wq // $lei->fail; # already failed
}
sub watch_state_ok ($) {
}
sub watch_state_ok ($) {
+ my ($lei, $wq) = @_;
+ return unless $lei->{sto};
local $current_lei = $lei;
local $current_lei = $lei;
+ my $sock = $wq ? $wq->{lei_sock} : undef;
eval {
if ($sock //= $lei->{sock}) { # issue, async wait
$lei->{sto}->wq_io_do('done', [ $sock ]);
eval {
if ($sock //= $lei->{sock}) { # issue, async wait
$lei->{sto}->wq_io_do('done', [ $sock ]);
}
sub _lei_wq_eof { # EOF callback for main lei daemon
}
sub _lei_wq_eof { # EOF callback for main lei daemon
- my ($lei) = @_;
- my $ikw = delete $lei->{ikw} or return $lei->fail;
- $lei->sto_done_request($ikw->{lei_sock});
}
sub _lei_wq_eof { # EOF callback for main lei daemon
}
sub _lei_wq_eof { # EOF callback for main lei daemon
- my ($lei) = @_;
- my $lne = delete $lei->{lne} or return $lei->fail;
- $lei->sto_done_request($lne->{lei_sock});
-# Copyright (C) 2021 all contributors <meta@public-inbox.org>
+# Copyright (C) all contributors <meta@public-inbox.org>
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# WQ worker for dealing with parallel Maildir reads;
# License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
# WQ worker for dealing with parallel Maildir reads;
}
sub _lei_wq_eof { # EOF callback for main lei daemon
}
sub _lei_wq_eof { # EOF callback for main lei daemon
- my ($lei) = @_;
- my $pmd = delete $lei->{pmd} or return $lei->fail;
- $lei->sto_done_request($pmd->{lei_sock});