about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2021-06-08 09:50:19 +0000
committerEric Wong <e@80x24.org>2021-06-08 16:50:46 +0000
commit11cf6468df48b9b9f34018cce1d20dc773322f2c (patch)
tree0408ade713d13a12a40353aa136209490925ce96
parentb922651ca3126510178eb9de244b66829e799853 (diff)
downloadpublic-inbox-11cf6468df48b9b9f34018cce1d20dc773322f2c.tar.gz
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.
-rw-r--r--lib/PublicInbox/LEI.pm2
1 files changed, 2 insertions, 0 deletions
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);