* [PATCH] lei: quiet excessive write/seen messages
@ 2023-10-12 0:21 7% Eric Wong
0 siblings, 0 replies; 1+ results
From: Eric Wong @ 2023-10-12 0:21 UTC (permalink / raw)
To: meta
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.
---
lib/PublicInbox/LEI.pm | 11 +++++++----
lib/PublicInbox/LeiXSearch.pm | 6 +++---
2 files changed, 10 insertions(+), 7 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);
diff --git a/lib/PublicInbox/LeiXSearch.pm b/lib/PublicInbox/LeiXSearch.pm
index 2a4af3e7..d83a403c 100644
--- a/lib/PublicInbox/LeiXSearch.pm
+++ b/lib/PublicInbox/LeiXSearch.pm
@@ -419,12 +419,12 @@ Error closing $lei->{ovv}->{dst}: \$!=$! \$?=$?
delete $l2m->{mbl}; # drop dotlock
}
}
+ my $nr_w = delete($lei->{-nr_write}) // 0;
+ my $nr_dup = (delete($lei->{-nr_seen}) // 0) - $nr_w;
if ($lei->{-progress}) {
my $tot = $lei->{-mset_total} // 0;
- my $nr_w = delete($lei->{-nr_write}) // 0;
- my $d = (delete($lei->{-nr_seen}) // 0) - $nr_w;
my $x = "$tot matches";
- $x .= ", $d duplicates" if $d;
+ $x .= ", $nr_dup duplicates" if $nr_dup;
if ($l2m) {
my $m = "# $nr_w written to " .
"$lei->{ovv}->{dst} ($x)";
^ permalink raw reply related [relevance 7%]
Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2023-10-12 0:21 7% [PATCH] lei: quiet excessive write/seen messages Eric Wong
Code repositories for project(s) associated with this public inbox
https://80x24.org/public-inbox.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).