about summary refs log tree commit homepage
path: root/lib/PublicInbox/LEI.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-12 00:21:00 +0000
committerEric Wong <e@80x24.org>2023-10-12 03:28:49 +0000
commiteeb7b20926d7837a789c60ad58b9d1e119ae3612 (patch)
tree7fd5560180d36913db173780525c519c22ea6e17 /lib/PublicInbox/LEI.pm
parent9d102fcf3fdc1f98999308de47fc6b71e83caf9c (diff)
downloadpublic-inbox-eeb7b20926d7837a789c60ad58b9d1e119ae3612.tar.gz
We don't want to end up dumping nr_seen/nr_write when progress
is disabled, nor do we want forked off `lei note-event' workers
dump them when DS->Reset is called on fork.
Diffstat (limited to 'lib/PublicInbox/LEI.pm')
-rw-r--r--lib/PublicInbox/LEI.pm11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index af39f8af..b00be1a1 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -631,6 +631,7 @@ sub pkt_op_pair {
 
 sub incr {
         my $lei = shift;
+        $lei->{incr_pid} = $$ if @_;
         while (my ($f, $n) = splice(@_, 0, 2)) { $lei->{$f} += $n }
 }
 
@@ -1399,10 +1400,12 @@ sub busy { 1 } # prevent daemon-shutdown if client is connected
 # can immediately reread it
 sub DESTROY {
         my ($self) = @_;
-        for my $k (sort(grep(/\A-nr_/, keys %$self))) {
-                my $nr = $self->{$k};
-                substr($k, 0, length('-nr_'), '');
-                $self->child_error(0, "$nr $k messages");
+        if (defined($self->{incr_pid}) && $self->{incr_pid} == $$) {
+                for my $k (sort(grep(/\A-nr_/, keys %$self))) {
+                        my $nr = $self->{$k};
+                        substr($k, 0, length('-nr_'), '');
+                        $self->child_error(0, "$nr $k messages");
+                }
         }
         $self->{1}->autoflush(1) if $self->{1};
         stop_pager($self);