]> Sergey Matveev's repositories - public-inbox.git/commitdiff
lei up: only show finmsg in top-level lei-daemon
authorEric Wong <e@80x24.org>
Tue, 31 Aug 2021 19:38:03 +0000 (19:38 +0000)
committerEric Wong <e@80x24.org>
Tue, 31 Aug 2021 20:08:05 +0000 (20:08 +0000)
->DESTROY can get triggered in child processes, which
unnecessarily duplicates messages queued up for display
when lei spawns extra workers.

lib/PublicInbox/LeiFinmsg.pm

index 0ef5f070201f226bf59dfece4c6564ee223b64f8..395e7d3c7083037b4fbf6e62c67265e09c9b6685 100644 (file)
@@ -9,13 +9,13 @@ use v5.10.1;
 
 sub new {
        my ($cls, $io) = @_;
-       bless [ $io ], $cls;
+       bless [ $io, $$ ], $cls;
 }
 
 sub DESTROY {
        my ($self) = @_;
        my $io = shift @$self;
-       print $io @$self;
+       shift(@$self) == $$ and print $io @$self;
 }
 
 1;