mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
only queue if not already queued
This commit is contained in:
@@ -78,9 +78,18 @@ 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;
|
||||||
|
for (FeedRefreshContext context : addQueue) {
|
||||||
|
if (context.getFeed().getId().equals(feed.getId())) {
|
||||||
|
alreadyQueued = true;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!alreadyQueued) {
|
||||||
addQueue.add(new FeedRefreshContext(feed, urgent));
|
addQueue.add(new FeedRefreshContext(feed, urgent));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* refills the refresh queue and empties the giveBack queue while at it
|
* refills the refresh queue and empties the giveBack queue while at it
|
||||||
|
|||||||
Reference in New Issue
Block a user