forked from Archives/Athou_commafeed
look subscriptions up only if needed
This commit is contained in:
@@ -140,14 +140,19 @@ public class FeedRefreshUpdater {
|
|||||||
public void run() {
|
public void run() {
|
||||||
boolean ok = true;
|
boolean ok = true;
|
||||||
if (entries.isEmpty() == false) {
|
if (entries.isEmpty() == false) {
|
||||||
List<FeedSubscription> subscriptions = feedSubscriptionDAO
|
|
||||||
.findByFeed(feed);
|
|
||||||
List<String> lastEntries = cache.getLastEntries(feed);
|
List<String> lastEntries = cache.getLastEntries(feed);
|
||||||
List<String> currentEntries = Lists.newArrayList();
|
List<String> currentEntries = Lists.newArrayList();
|
||||||
|
|
||||||
|
List<FeedSubscription> subscriptions = null;
|
||||||
for (FeedEntry entry : entries) {
|
for (FeedEntry entry : entries) {
|
||||||
String cacheKey = cache.buildKey(feed, entry);
|
String cacheKey = cache.buildKey(feed, entry);
|
||||||
if (!lastEntries.contains(cacheKey)) {
|
if (!lastEntries.contains(cacheKey)) {
|
||||||
log.debug("cache miss for {}", entry.getUrl());
|
log.debug("cache miss for {}", entry.getUrl());
|
||||||
|
if (subscriptions == null) {
|
||||||
|
subscriptions = feedSubscriptionDAO
|
||||||
|
.findByFeed(feed);
|
||||||
|
}
|
||||||
ok &= updateEntry(feed, entry, subscriptions);
|
ok &= updateEntry(feed, entry, subscriptions);
|
||||||
metricsBean.entryCacheMiss();
|
metricsBean.entryCacheMiss();
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user