skip entries that were deleted by the cleanup task

This commit is contained in:
Athou
2015-02-25 15:14:01 +01:00
parent 1d088c5eae
commit 928a45e48e

View File

@@ -5,6 +5,7 @@ import io.dropwizard.lifecycle.Managed;
import java.util.Date;
import java.util.List;
import java.util.Optional;
import java.util.stream.Collectors;
import javax.inject.Inject;
import javax.inject.Singleton;
@@ -90,6 +91,11 @@ public class FeedRefreshWorker implements Managed {
// stops here if NotModifiedException or any other exception is thrown
List<FeedEntry> entries = fetchedFeed.getEntries();
Integer maxFeedCapacity = config.getApplicationSettings().getMaxFeedCapacity();
if (maxFeedCapacity > 0) {
entries = entries.stream().limit(maxFeedCapacity).collect(Collectors.toList());
}
if (config.getApplicationSettings().getHeavyLoad()) {
disabledUntil = FeedUtils.buildDisabledUntil(fetchedFeed.getFeed().getLastEntryDate(), fetchedFeed.getFeed()
.getAverageEntryInterval(), disabledUntil);