]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiStore.pm
git: use async_wait_all everywhere
[public-inbox.git] / lib / PublicInbox / LeiStore.pm
index 08add8f5a05496ab234f5cfad9737903de0c009a..52a1456fb41544e4bee7ad21c1a0f662bc59d13c 100644 (file)
@@ -305,7 +305,7 @@ sub remove_eml {
                        $git->cat_async($oidhex, \&_remove_if_local, $self);
                }
        }
-       $git->cat_async_wait;
+       $git->async_wait_all;
        remove_docids($self, @docids);
        \@docids;
 }
@@ -534,10 +534,6 @@ sub done {
        $self->{priv_eidx}->done; # V2Writable::done
        xchg_stderr($self);
        die $err if $err;
-
-       # notify clients ->done has been issued
-       defined($sock_ref) and
-               $self->{s2d_op_p}->pkt_do('sto_done_complete', $sock_ref);
 }
 
 sub ipc_atfork_child {
@@ -552,32 +548,30 @@ sub ipc_atfork_child {
        $self->SUPER::ipc_atfork_child;
 }
 
+sub recv_and_run {
+       my ($self, @args) = @_;
+       local $PublicInbox::DS::in_loop = 0; # waitpid synchronously
+       $self->SUPER::recv_and_run(@args);
+}
+
 sub write_prepare {
        my ($self, $lei) = @_;
        $lei // die 'BUG: $lei not passed';
        unless ($self->{-ipc_req}) {
-               # s2d => store-to-daemon messages
-               require PublicInbox::PktOp;
-               my ($s2d_op_c, $s2d_op_p) = PublicInbox::PktOp->pair;
                my $dir = $lei->store_path;
-               $self->ipc_lock_init("$dir/ipc.lock");
                substr($dir, -length('/lei/store'), 10, '');
                pipe(my ($r, $w)) or die "pipe: $!";
                $w->autoflush(1);
                # Mail we import into lei are private, so headers filtered out
                # by -mda for public mail are not appropriate
                local @PublicInbox::MDA::BAD_HEADERS = ();
-               $self->ipc_worker_spawn("lei/store $dir", $lei->oldset, {
+               $self->wq_workers_start("lei/store $dir", 1, $lei->oldset, {
                                        lei => $lei,
                                        -err_wr => $w,
-                                       to_close => [ $r, $s2d_op_c->{sock} ],
-                                       s2d_op_p => $s2d_op_p,
+                                       to_close => [ $r ],
                                });
                require PublicInbox::LeiStoreErr;
                PublicInbox::LeiStoreErr->new($r, $lei);
-               $s2d_op_c->{ops} = {
-                       sto_done_complete => [ $lei->can('sto_done_complete') ]
-               };
        }
        $lei->{sto} = $self;
 }