don't update the database if the feed didn't change

This commit is contained in:
Athou
2013-04-18 13:22:59 +02:00
parent af109ccf5c
commit db8fc29d4f
2 changed files with 9 additions and 2 deletions

View File

@@ -40,7 +40,7 @@ public class FeedRefreshTaskGiver {
public Feed take() {
if (queue.peek() == null) {
List<Feed> feeds = feedDAO
.findNextUpdatable(30 * applicationSettingsService.get()
.findNextUpdatable(50 * applicationSettingsService.get()
.getBackgroundThreads());
for (Feed feed : feeds) {
queue.add(feed);

View File

@@ -82,10 +82,12 @@ public class FeedRefreshWorker {
Date disabledUntil = null;
Feed fetchedFeed = null;
boolean modified = true;
try {
fetchedFeed = fetcher.fetch(feed.getUrl(), false,
feed.getLastModifiedHeader(), feed.getEtagHeader());
} catch (NotModifiedException e) {
modified = false;
log.debug("Feed not modified (304) : " + feed.getUrl());
} catch (Exception e) {
message = "Unable to refresh feed " + feed.getUrl() + " : "
@@ -104,8 +106,13 @@ public class FeedRefreshWorker {
}
}
feed.setMessage(message);
if (modified == false && feed.getErrorCount() == 0) {
// not modified
return;
}
feed.setErrorCount(errorCount);
feed.setMessage(message);
feed.setDisabledUntil(disabledUntil);
if (fetchedFeed != null) {