settings for heavy load

This commit is contained in:
Athou
2013-05-21 08:46:14 +02:00
parent 5a9e910ca8
commit 9c9a315d1c
3 changed files with 22 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import com.commafeed.backend.HttpGetter.NotModifiedException;
import com.commafeed.backend.model.Feed;
import com.commafeed.backend.model.FeedEntry;
import com.commafeed.backend.model.FeedPushInfo;
import com.commafeed.backend.services.ApplicationSettingsService;
import com.sun.syndication.io.FeedException;
public class FeedRefreshWorker {
@@ -37,6 +38,9 @@ public class FeedRefreshWorker {
@Inject
FeedRefreshTaskGiver taskGiver;
@Inject
ApplicationSettingsService applicationSettingsService;
public void start(MutableBoolean running, String threadName) {
log.info("{} starting", threadName);
while (running.isTrue()) {
@@ -83,7 +87,9 @@ public class FeedRefreshWorker {
// stops here if NotModifiedException or any other exception is
// thrown
entries = fetchedFeed.getEntries();
disabledUntil = FeedUtils.buildDisabledUntil(fetchedFeed);
if (applicationSettingsService.get().isHeavyLoad()) {
disabledUntil = FeedUtils.buildDisabledUntil(fetchedFeed);
}
feed.setLastUpdateSuccess(Calendar.getInstance().getTime());
feed.setLink(fetchedFeed.getFeed().getLink());

View File

@@ -25,6 +25,7 @@ public class ApplicationSettings extends AbstractModel {
private boolean smtpTls;
private String smtpUserName;
private String smtpPassword;
private boolean heavyLoad;
private boolean pubsubhubbub;
private boolean feedbackButton = true;
@@ -144,4 +145,12 @@ public class ApplicationSettings extends AbstractModel {
this.pubsubhubbub = pubsubhubbub;
}
public boolean isHeavyLoad() {
return heavyLoad;
}
public void setHeavyLoad(boolean heavyLoad) {
this.heavyLoad = heavyLoad;
}
}