diff --git a/src/main/java/com/commafeed/backend/feeds/FeedRefreshWorker.java b/src/main/java/com/commafeed/backend/feeds/FeedRefreshWorker.java index fdee6d02..e30ea964 100644 --- a/src/main/java/com/commafeed/backend/feeds/FeedRefreshWorker.java +++ b/src/main/java/com/commafeed/backend/feeds/FeedRefreshWorker.java @@ -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()); diff --git a/src/main/java/com/commafeed/backend/model/ApplicationSettings.java b/src/main/java/com/commafeed/backend/model/ApplicationSettings.java index 68fc0b23..1a44f70d 100644 --- a/src/main/java/com/commafeed/backend/model/ApplicationSettings.java +++ b/src/main/java/com/commafeed/backend/model/ApplicationSettings.java @@ -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; + } + } diff --git a/src/main/webapp/templates/admin.settings.html b/src/main/webapp/templates/admin.settings.html index 22bcc325..fc22cf33 100644 --- a/src/main/webapp/templates/admin.settings.html +++ b/src/main/webapp/templates/admin.settings.html @@ -111,6 +111,12 @@ ng-model="settings.smtpPassword" /> +