mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
delay based on heavy load setting
This commit is contained in:
@@ -43,9 +43,10 @@ public class FeedRefreshTaskGiver {
|
|||||||
@Lock(LockType.WRITE)
|
@Lock(LockType.WRITE)
|
||||||
public void add(Feed feed) {
|
public void add(Feed feed) {
|
||||||
Date now = Calendar.getInstance().getTime();
|
Date now = Calendar.getInstance().getTime();
|
||||||
Date tenMinutesAgo = DateUtils.addMinutes(now, -10);
|
boolean heavyLoad = applicationSettingsService.get().isHeavyLoad();
|
||||||
|
Date threshold = DateUtils.addMinutes(now, heavyLoad ? -10 : -1);
|
||||||
if (feed.getLastUpdated() == null
|
if (feed.getLastUpdated() == null
|
||||||
|| feed.getLastUpdated().before(tenMinutesAgo)) {
|
|| feed.getLastUpdated().before(threshold)) {
|
||||||
feed.setEtagHeader(null);
|
feed.setEtagHeader(null);
|
||||||
feed.setLastModifiedHeader(null);
|
feed.setLastModifiedHeader(null);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user