X-Git-Url: http://git.vanrenterghem.biz/git.ikiwiki.info.git/blobdiff_plain/82ac63d798cc7f45a42e14bc2ad05a9388e25a04..8a6a0673339c00480d49513eb0e3db83a9c7ce9c:/IkiWiki/Plugin/aggregate.pm diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm index 082290114..eb5067d9f 100644 --- a/IkiWiki/Plugin/aggregate.pm +++ b/IkiWiki/Plugin/aggregate.pm @@ -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};