delay based on heavy load setting

This commit is contained in:
Athou
2013-05-21 10:44:05 +02:00
parent 2743e73133
commit 36e39b8c75

View File

@@ -43,9 +43,10 @@ public class FeedRefreshTaskGiver {
@Lock(LockType.WRITE)
public void add(Feed feed) {
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
|| feed.getLastUpdated().before(tenMinutesAgo)) {
|| feed.getLastUpdated().before(threshold)) {
feed.setEtagHeader(null);
feed.setLastModifiedHeader(null);
}