]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/commitdiff
improve use of seen hash
authorJoey Hess <joey@kodama.kitenet.net>
Wed, 31 Oct 2007 02:56:13 +0000 (22:56 -0400)
committerJoey Hess <joey@kodama.kitenet.net>
Wed, 31 Oct 2007 02:56:13 +0000 (22:56 -0400)
IkiWiki/Plugin/aggregate.pm

index 1add539874bd478f8213073300c2469aae92931f..ea27fc19932e7638758d00f252ca8c0ff9c267b4 100644 (file)
@@ -222,9 +222,8 @@ sub expire () { #{{{
                my $count=0;
                my %seen;
                foreach my $item (sort { $IkiWiki::pagectime{$b->{page}} <=> $IkiWiki::pagectime{$a->{page}} }
-                                 grep { exists $_->{page} && ! exists $seen{$_->{page}} && $_->{feed} eq $feed->{name} && $IkiWiki::pagectime{$_->{page}} }
+                                 grep { exists $_->{page} && $_->{feed} eq $feed->{name} && $IkiWiki::pagectime{$_->{page}} }
                                  values %guids) {
-                       $seen{$item}=1;
                        if ($feed->{expireage}) {
                                my $days_old = (time - $IkiWiki::pagectime{$item->{page}}) / 60 / 60 / 24;
                                if ($days_old > $feed->{expireage}) {
@@ -239,7 +238,10 @@ sub expire () { #{{{
                                $item->{expired}=1;
                        }
                        else {
-                               $count++;
+                               if (! $seen{$item->{page}}) {
+                                       $seen{$item->{page}}=1;
+                                       $count++;
+                               }
                        }
                }
        }