summaryrefslogtreecommitdiffstats
path: root/service
diff options
context:
space:
mode:
authorBernhard Posselt <dev@bernhard-posselt.com>2015-11-20 19:55:23 +0100
committerBernhard Posselt <dev@bernhard-posselt.com>2015-11-20 19:55:23 +0100
commitc995c5b447cd32f4eb9f3cd9fc1865fd93962f24 (patch)
tree99390128e13da58b9f3059a4961fa4b2fb7c6cea /service
parentfae882f834409e18174e05d19deea39a3bf01e7b (diff)
If a feed failed to update more than 10 times, show a hint in the web interface
Diffstat (limited to 'service')
-rw-r--r--service/feedservice.php19
1 files changed, 10 insertions, 9 deletions
diff --git a/service/feedservice.php b/service/feedservice.php
index ef1490106..f3c64373d 100644
--- a/service/feedservice.php
+++ b/service/feedservice.php
@@ -160,8 +160,9 @@ class FeedService extends Service {
try {
$this->update($feed->getId(), $feed->getUserId());
} catch(\Exception $ex){
- $this->logger->debug(
- 'Could not update feed ' . $ex->getMessage(),
+ // something is really wrong here, log it
+ $this->logger->error(
+ 'Unexpected error when updating feed ' . $ex->getMessage(),
$this->loggerParams
);
}
@@ -220,7 +221,6 @@ class FeedService extends Service {
$existingFeed->setLastModified($fetchedFeed->getLastModified());
$existingFeed->setEtag($fetchedFeed->getEtag());
$existingFeed->setLocation($fetchedFeed->getLocation());
- $this->feedMapper->update($existingFeed);
// insert items in reverse order because the first one is
// usually the newest item
@@ -265,16 +265,17 @@ class FeedService extends Service {
}
}
+ // mark feed as successfully updated
+ $existingFeed->setUpdateErrorCount(0);
+
} catch(FetcherException $ex){
- // failed updating is not really a problem, so only log it
- $this->logger->debug(
- 'Can not update feed with url ' . $existingFeed->getUrl() .
- ' and location ' . $existingFeed->getLocation() .
- ': ' . $ex->getMessage(),
- $this->loggerParams
+ $existingFeed->setUpdateErrorCount(
+ $existingFeed->getUpdateErrorCount()+1
);
}
+ $this->feedMapper->update($existingFeed);
+
return $this->find($feedId, $userId);
}