From c995c5b447cd32f4eb9f3cd9fc1865fd93962f24 Mon Sep 17 00:00:00 2001 From: Bernhard Posselt Date: Fri, 20 Nov 2015 19:55:23 +0100 Subject: If a feed failed to update more than 10 times, show a hint in the web interface --- service/feedservice.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'service/feedservice.php') 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); } -- cgit v1.2.3