summaryrefslogtreecommitdiff
path: root/IkiWiki/Plugin/aggregate.pm
diff options
context:
space:
mode:
authorJoey Hess <joey@gnu.kitenet.net>2008-12-17 21:27:28 -0500
committerJoey Hess <joey@gnu.kitenet.net>2008-12-17 21:27:28 -0500
commitf3bec255e4f62f31bf7b2f99d941c79e1fe93559 (patch)
treee3fcb5424503a694fc66a9f716a981ac139ab45b /IkiWiki/Plugin/aggregate.pm
parent385123006e528149fbc5750209151462b056b124 (diff)
aggregate: If a feed fails to be downloaded, try again immediatly next time aggregation is run, even if the usual time has not passed. Closes: #508622 (Michael Gold)
Diffstat (limited to 'IkiWiki/Plugin/aggregate.pm')
-rw-r--r--IkiWiki/Plugin/aggregate.pm13
1 files changed, 9 insertions, 4 deletions
diff --git a/IkiWiki/Plugin/aggregate.pm b/IkiWiki/Plugin/aggregate.pm
index 29bc6d0ce..9b531b612 100644
--- a/IkiWiki/Plugin/aggregate.pm
+++ b/IkiWiki/Plugin/aggregate.pm
@@ -245,6 +245,7 @@ sub preprocess (@) {
$feed->{template}=$params{template} . ".tmpl";
delete $feed->{unseen};
$feed->{lastupdate}=0 unless defined $feed->{lastupdate};
+ $feed->{lasttry}=$feed->{lastupdate} unless defined $feed->{lasttry};
$feed->{numposts}=0 unless defined $feed->{numposts};
$feed->{newposts}=0 unless defined $feed->{newposts};
$feed->{message}=gettext("new feed") unless defined $feed->{message};
@@ -390,8 +391,8 @@ sub mergestate () {
# fields.
foreach my $name (keys %myfeeds) {
if (exists $feeds{$name}) {
- foreach my $field (qw{message lastupdate numposts
- newposts error}) {
+ foreach my $field (qw{message lastupdate lasttry
+ numposts newposts error}) {
$feeds{$name}->{$field}=$myfeeds{$name}->{$field};
}
}
@@ -458,10 +459,10 @@ sub aggregate (@) {
error($@) if $@;
foreach my $feed (@_) {
- $feed->{lastupdate}=time;
+ $feed->{lasttry}=time;
$feed->{newposts}=0;
$feed->{message}=sprintf(gettext("last checked %s"),
- displaytime($feed->{lastupdate}));
+ displaytime($feed->{lasttry}));
$feed->{error}=0;
debug(sprintf(gettext("checking feed %s ..."), $feed->{name}));
@@ -483,6 +484,10 @@ sub aggregate (@) {
debug($feed->{message});
next;
}
+
+ # lastupdate is only set if we were able to contact the server
+ $feed->{lastupdate}=$feed->{lasttry};
+
if ($res->status == URI::Fetch::URI_GONE()) {
$feed->{message}=gettext("feed not found");
$feed->{error}=1;