mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
rewrite using lambda
This commit is contained in:
@@ -78,13 +78,7 @@ public class FeedQueues {
|
|||||||
public void add(Feed feed, boolean urgent) {
|
public void add(Feed feed, boolean urgent) {
|
||||||
int refreshInterval = config.getApplicationSettings().getRefreshIntervalMinutes();
|
int refreshInterval = config.getApplicationSettings().getRefreshIntervalMinutes();
|
||||||
if (feed.getLastUpdated() == null || feed.getLastUpdated().before(DateUtils.addMinutes(new Date(), -1 * refreshInterval))) {
|
if (feed.getLastUpdated() == null || feed.getLastUpdated().before(DateUtils.addMinutes(new Date(), -1 * refreshInterval))) {
|
||||||
boolean alreadyQueued = false;
|
boolean alreadyQueued = addQueue.stream().anyMatch(c -> c.getFeed().getId().equals(feed.getId()));
|
||||||
for (FeedRefreshContext context : addQueue) {
|
|
||||||
if (context.getFeed().getId().equals(feed.getId())) {
|
|
||||||
alreadyQueued = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!alreadyQueued) {
|
if (!alreadyQueued) {
|
||||||
addQueue.add(new FeedRefreshContext(feed, urgent));
|
addQueue.add(new FeedRefreshContext(feed, urgent));
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user