about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2024-04-16 20:56:27 +0000
committerEric Wong <e@80x24.org>2024-04-17 09:22:52 +0000
commitcad60b2aa5fee563f2a6b41fa0cc7267e13e4bde (patch)
tree16b82491371a51f2f3879dada0b64a6cce80d613 /lib/PublicInbox/LEI.pm
parent6b536768f828b12293ecd57ba93ecfa135fc2c77 (diff)
downloadpublic-inbox-cad60b2aa5fee563f2a6b41fa0cc7267e13e4bde.tar.gz
lei: use ->barrier to commit to lei/store
barrier (synchronous checkpoint) is better than ->done with
parallel lei commands being issued (via '&' or different
terminals), since repeatedly stopping and restarting processes
doesn't play nicely with expensive tasks like `lei reindex'.

This introduces a slight regression in maintaining more
processes (and thus resource use) when lei is idle, but that'll
be fixed in the next commit.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm6
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 5b46686a..e9a0de6c 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -1443,7 +1443,7 @@ sub wq_eof { # EOF callback for main daemon
         my ($lei, $wq_fld) = @_;
         local $current_lei = $lei;
         my $wq = delete $lei->{$wq_fld // 'wq1'};
-        $lei->sto_done_request($wq);
+        $lei->sto_barrier_request($wq);
         $wq // $lei->fail; # already failed
 }
 
@@ -1548,7 +1548,7 @@ sub lms {
         (-f $f || $creat) ? PublicInbox::LeiMailSync->new($f) : undef;
 }
 
-sub sto_done_request {
+sub sto_barrier_request {
         my ($lei, $wq) = @_;
         return unless $lei->{sto} && $lei->{sto}->{-wq_s1};
         local $current_lei = $lei;
@@ -1558,7 +1558,7 @@ sub sto_done_request {
                 my $s = ($wq ? $wq->{lei_sock} : undef) // $lei->{sock};
                 my $errfh = $lei->{2} // *STDERR{GLOB};
                 my @io = $s ? ($errfh, $s) : ($errfh);
-                eval { $lei->{sto}->wq_io_do('done', \@io) };
+                eval { $lei->{sto}->wq_io_do('barrier', \@io, 1) };
         }
         warn($@) if $@;
 }