]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/LeiP2q.pm
lei + ipc: simplify process reaping
[public-inbox.git] / lib / PublicInbox / LeiP2q.pm
index b48934898db916b9f2a7a4bbd8dc859138477510..08ec81c5295ee3c43831dad38e3ef313c1e51dd6 100644 (file)
@@ -135,7 +135,7 @@ sub do_p2q { # via wq_do
        if ($lei->{opt}->{debug}) {
                my $json = ref(PublicInbox::Config->json)->new;
                $json->utf8->canonical->pretty;
-               $lei->err($json->encode($lei->{qterms}));
+               print { $lei->{2} } $json->encode($lei->{qterms});
        }
        my (@q, %seen);
        for my $pfx (@want) {
@@ -188,11 +188,11 @@ sub lei_p2q { # the "lei patch-to-query" entry point
        } else {
                $self->{input} = $input;
        }
-       my ($op, $ops) = $lei->workers_start($self, 'lei-p2q', 1);
+       my ($op_c, $ops) = $lei->workers_start($self, 1);
        $lei->{wq1} = $self;
        $self->wq_io_do('do_p2q', []);
-       $self->wq_close(1);
-       $op->op_wait_event($ops);
+       $self->wq_close;
+       $lei->wait_wq_events($op_c, $ops);
 }
 
 sub ipc_atfork_child {