]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei: safety fix for multiple WQ classes
authorEric Wong <e@80x24.org>
Tue, 8 Jun 2021 09:50:19 +0000 (09:50 +0000)
committerEric Wong <e@80x24.org>
Tue, 8 Jun 2021 16:50:46 +0000 (16:50 +0000)
For commands utilizing multiple workers, this simple change
generalizes the persistence mechanism and and prevents
lei->dclose from causing script/lei to exit if there are
still in-flight workers.

This ougth to prevent read-after-write consistency problems that
occasionally manifest in scripts (e.g. test cases) but usually
go unnoticed in normal use.

lib/PublicInbox/LEI.pm

index 8adf70faf2d70dbcf629e103bdf9fd589b2673da..0cf4d10b892b287eabbc6a14a50cb9d400791c00 100644 (file)
@@ -580,6 +580,8 @@ sub workers_start {
        $wq->wq_workers_start($ident, $jobs, $lei->oldset, { lei => $lei });
        delete $lei->{pkt_op_p};
        my $op_c = delete $lei->{pkt_op_c};
+       # {-lei_sock} persists script/lei process until ops->{''} EOF callback
+       $op_c->{-lei_sock} = $lei->{sock};
        @$end = ();
        $lei->event_step_init;
        ($op_c, $ops);