forked from Archives/Athou_commafeed
don't update the database if the feed didn't change
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user