]> Sergey Matveev's repositories - public-inbox.git/commitdiff
inbox: do not weaken already-weak refs
authorEric Wong <e@80x24.org>
Fri, 24 Jun 2016 23:40:01 +0000 (23:40 +0000)
committerEric Wong <e@80x24.org>
Sat, 25 Jun 2016 00:25:29 +0000 (00:25 +0000)
This quiets a (hopefully harmless) warning when a ref remains
alive through several expiry timeouts.

lib/PublicInbox/Inbox.pm

index 3f1b7334f01109343a1b1723c165f6d5bbe5b299..34191fc79508f04ff9ce00cc3782333dd1c033bf 100644 (file)
@@ -5,7 +5,7 @@
 package PublicInbox::Inbox;
 use strict;
 use warnings;
-use Scalar::Util qw(weaken);
+use Scalar::Util qw(weaken isweak);
 use PublicInbox::Git;
 use PublicInbox::MID qw(mid2path);
 
@@ -19,7 +19,9 @@ sub new {
 
 sub weaken_all {
        my ($self) = @_;
-       weaken($self->{$_}) foreach qw(git mm search);
+       foreach my $f (qw(git mm search)) {
+               isweak($self->{$f}) or weaken($self->{$f});
+       }
 }
 
 sub git {