]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/aggregate.pm
web commit by http://ptecza.myopenid.com/: * Question about nested plugins
[git.ikiwiki.info.git] / IkiWiki / Plugin / aggregate.pm
index 082290114fa8a382a133f6cfbcb2d8065c40eaca..eb5067d9f5977cafea958e6e5849c4fd866a34c1 100644 (file)
@@ -33,14 +33,17 @@ sub getopt () { #{{{
 sub checkconfig () { #{{{
        if ($config{aggregate} && ! ($config{post_commit} && 
                                     IkiWiki::commit_hook_enabled())) {
-               # don't wait for the lock
-               IkiWiki::lockwiki(0) || exit 1;
+               if (! IkiWiki::lockwiki(0)) {
+                       debug("wiki is locked by another process, not aggregating");
+                       exit 1;
+               }
        
                loadstate();
                IkiWiki::loadindex();
                aggregate();
                expire();
                savestate();
+               clearstate();
 
                IkiWiki::unlockwiki();
        }
@@ -207,6 +210,12 @@ sub savestate () { #{{{
                error("rename $newfile: $!", $cleanup);
 } #}}}
 
+sub clearstate () { #{{{
+       %feeds=();
+       %guids=();
+       $state_loaded=0;
+} #}}}
+
 sub expire () { #{{{
        foreach my $feed (values %feeds) {
                next unless $feed->{expireage} || $feed->{expirecount};