mirror of
https://github.com/Athou/commafeed.git
synced 2026-03-21 21:37:29 +00:00
setting to pause feed crawling
This commit is contained in:
@@ -22,6 +22,7 @@ import com.commafeed.backend.dao.FeedDAO;
|
||||
import com.commafeed.backend.model.Feed;
|
||||
import com.commafeed.backend.services.ApplicationSettingsService;
|
||||
import com.google.api.client.util.Maps;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Queues;
|
||||
|
||||
@ApplicationScoped
|
||||
@@ -134,7 +135,12 @@ public class FeedRefreshTaskGiver {
|
||||
Date now = new Date();
|
||||
|
||||
int count = 3 * backgroundThreads;
|
||||
List<Feed> feeds = feedDAO.findNextUpdatable(count, getThreshold());
|
||||
List<Feed> feeds = null;
|
||||
if (applicationSettingsService.get().isCrawlingPaused()) {
|
||||
feeds = Lists.newArrayList();
|
||||
} else {
|
||||
feeds = feedDAO.findNextUpdatable(count, getThreshold());
|
||||
}
|
||||
|
||||
int size = addQueue.size();
|
||||
for (int i = 0; i < size; i++) {
|
||||
|
||||
@@ -34,6 +34,7 @@ public class ApplicationSettings extends AbstractModel {
|
||||
private String logLevel = Level.INFO.toString();
|
||||
private boolean imageProxyEnabled;
|
||||
private int queryTimeout;
|
||||
private boolean crawlingPaused;
|
||||
|
||||
@Column(length = 255)
|
||||
private String announcement;
|
||||
@@ -191,4 +192,12 @@ public class ApplicationSettings extends AbstractModel {
|
||||
this.queryTimeout = queryTimeout;
|
||||
}
|
||||
|
||||
public boolean isCrawlingPaused() {
|
||||
return crawlingPaused;
|
||||
}
|
||||
|
||||
public void setCrawlingPaused(boolean crawlingPaused) {
|
||||
this.crawlingPaused = crawlingPaused;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -256,5 +256,14 @@
|
||||
<column name="normalizedUrlHash" />
|
||||
</createIndex>
|
||||
</changeSet>
|
||||
|
||||
<changeSet author="athou" id="add-pause-crawling">
|
||||
<addColumn tableName="APPLICATIONSETTINGS">
|
||||
<column name="crawlingPaused" type="BIT" />
|
||||
</addColumn>
|
||||
<update tableName="APPLICATIONSETTINGS">
|
||||
<column name="crawlingPaused" valueBoolean="false"></column>
|
||||
</update>
|
||||
</changeSet>
|
||||
|
||||
</databaseChangeLog>
|
||||
|
||||
@@ -158,6 +158,12 @@
|
||||
ng-model="settings.queryTimeout" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
<label class="control-label" for="crawlingPaused">Pause crawling</label>
|
||||
<div class="controls">
|
||||
<input type="checkbox" name="crawlingPaused" ng-model="settings.crawlingPaused" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="control-group">
|
||||
|
||||
Reference in New Issue
Block a user