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)

master
Joey Hess 2008-12-17 21:27:28 -05:00
parent 385123006e
commit f3bec255e4
2 changed files with 12 additions and 4 deletions

View File

@ -245,6 +245,7 @@ sub preprocess (@) {
$feed->{template}=$params{template} . ".tmpl"; $feed->{template}=$params{template} . ".tmpl";
delete $feed->{unseen}; delete $feed->{unseen};
$feed->{lastupdate}=0 unless defined $feed->{lastupdate}; $feed->{lastupdate}=0 unless defined $feed->{lastupdate};
$feed->{lasttry}=$feed->{lastupdate} unless defined $feed->{lasttry};
$feed->{numposts}=0 unless defined $feed->{numposts}; $feed->{numposts}=0 unless defined $feed->{numposts};
$feed->{newposts}=0 unless defined $feed->{newposts}; $feed->{newposts}=0 unless defined $feed->{newposts};
$feed->{message}=gettext("new feed") unless defined $feed->{message}; $feed->{message}=gettext("new feed") unless defined $feed->{message};
@ -390,8 +391,8 @@ sub mergestate () {
# fields. # fields.
foreach my $name (keys %myfeeds) { foreach my $name (keys %myfeeds) {
if (exists $feeds{$name}) { if (exists $feeds{$name}) {
foreach my $field (qw{message lastupdate numposts foreach my $field (qw{message lastupdate lasttry
newposts error}) { numposts newposts error}) {
$feeds{$name}->{$field}=$myfeeds{$name}->{$field}; $feeds{$name}->{$field}=$myfeeds{$name}->{$field};
} }
} }
@ -458,10 +459,10 @@ sub aggregate (@) {
error($@) if $@; error($@) if $@;
foreach my $feed (@_) { foreach my $feed (@_) {
$feed->{lastupdate}=time; $feed->{lasttry}=time;
$feed->{newposts}=0; $feed->{newposts}=0;
$feed->{message}=sprintf(gettext("last checked %s"), $feed->{message}=sprintf(gettext("last checked %s"),
displaytime($feed->{lastupdate})); displaytime($feed->{lasttry}));
$feed->{error}=0; $feed->{error}=0;
debug(sprintf(gettext("checking feed %s ..."), $feed->{name})); debug(sprintf(gettext("checking feed %s ..."), $feed->{name}));
@ -483,6 +484,10 @@ sub aggregate (@) {
debug($feed->{message}); debug($feed->{message});
next; next;
} }
# lastupdate is only set if we were able to contact the server
$feed->{lastupdate}=$feed->{lasttry};
if ($res->status == URI::Fetch::URI_GONE()) { if ($res->status == URI::Fetch::URI_GONE()) {
$feed->{message}=gettext("feed not found"); $feed->{message}=gettext("feed not found");
$feed->{error}=1; $feed->{error}=1;

3
debian/changelog vendored
View File

@ -20,6 +20,9 @@ ikiwiki (2.71) UNRELEASED; urgency=low
* monotone: When getting the log, tell monotone how many entries * monotone: When getting the log, tell monotone how many entries
we want, rather than closing the pipe, which it dislikes. (thm) we want, rather than closing the pipe, which it dislikes. (thm)
* Coding style change: Remove explcit vim folding markers. * Coding style change: Remove explcit vim folding markers.
* 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)
-- Joey Hess <joeyh@debian.org> Mon, 17 Nov 2008 14:02:10 -0500 -- Joey Hess <joeyh@debian.org> Mon, 17 Nov 2008 14:02:10 -0500