From 11cf6468df48b9b9f34018cce1d20dc773322f2c Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Tue, 8 Jun 2021 09:50:19 +0000 Subject: [PATCH] lei: safety fix for multiple WQ classes 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 | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm index 8adf70fa..0cf4d10b 100644 --- a/lib/PublicInbox/LEI.pm +++ b/lib/PublicInbox/LEI.pm @@ -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); -- 2.44.0