mirror of
https://github.com/internetarchive/heritrix3.git
synced 2026-07-21 15:01:46 +00:00
check controller state, not frontier.isEmpty)
This commit is contained in:
@@ -27,7 +27,6 @@ import org.archive.crawler.event.AMQPUrlReceivedEvent;
|
||||
import org.archive.crawler.event.StatSnapshotEvent;
|
||||
import org.archive.crawler.framework.CrawlController;
|
||||
import org.archive.crawler.framework.CrawlStatus;
|
||||
import org.archive.crawler.framework.Frontier;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.ApplicationEvent;
|
||||
import org.springframework.context.ApplicationListener;
|
||||
@@ -55,16 +54,6 @@ public class AMQPUrlWaiter implements ApplicationListener<ApplicationEvent> {
|
||||
this.controller = controller;
|
||||
}
|
||||
|
||||
protected Frontier frontier;
|
||||
public Frontier getFrontier() {
|
||||
return this.frontier;
|
||||
}
|
||||
/** Autowired frontier, needed to determine when a url is finished. */
|
||||
@Autowired
|
||||
public void setFrontier(Frontier frontier) {
|
||||
this.frontier = frontier;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onApplicationEvent(ApplicationEvent event) {
|
||||
if (event instanceof AMQPUrlPublishedEvent) {
|
||||
@@ -77,8 +66,8 @@ public class AMQPUrlWaiter implements ApplicationListener<ApplicationEvent> {
|
||||
}
|
||||
|
||||
protected void checkAMQPUrlWait() {
|
||||
if (frontier.isEmpty() && (urlsPublished == 0 || urlsReceived > 0)) {
|
||||
logger.info("frontier is empty and we have received " + urlsReceived +
|
||||
if (controller.getState() == CrawlController.State.EMPTY && (urlsPublished == 0 || urlsReceived > 0)) {
|
||||
logger.info("crawl controller state is empty and we have received " + urlsReceived +
|
||||
" urls from AMQP, and published " + urlsPublished +
|
||||
", stopping crawl with status " + CrawlStatus.FINISHED);
|
||||
controller.requestCrawlStop(CrawlStatus.FINISHED);
|
||||
|
||||
Reference in New Issue
Block a user