Skip to content

armgit / nutch

Public Imported from GitHub
0

Apache Nutch is an extensible and scalable web crawler

NUTCH-753 Prevent new Fetcher from retrieving the robots twice.

Andrzej Bialeckic5e0de44df57
diff --git a/CHANGES.txt b/CHANGES.txt
index 540ba31b4..40889cdf6 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -2,7 +2,9 @@ Nutch Change Log
Unreleased Changes
-* NUTCH-773 - Some minor bugs in AbstractFetchSchedule (Reinhard Schwab)
+* NUTCH-753 Prevent new Fetcher from retrieving the robots twice (Julien Nioche via ab)
+
+* NUTCH-773 - Some minor bugs in AbstractFetchSchedule (Reinhard Schwab via ab)
* NUTCH-765 - Allow Crawl class to call Either Solr or Lucene Indexer (kubes)
diff --git a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
index 9f513eab5..63712bfb8 100644
--- a/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
+++ b/src/plugin/lib-http/src/java/org/apache/nutch/protocol/http/api/HttpBase.java
@@ -185,6 +185,7 @@ public abstract class HttpBase implements Protocol {
String urlString = url.toString();
try {
URL u = new URL(urlString);
+ long delay = serverDelay;
if (checkRobots) {
try {
@@ -197,10 +198,10 @@ public abstract class HttpBase implements Protocol {
logger.trace("Exception checking robot rules for " + url + ": " + e);
}
}
+
+ long crawlDelay = robots.getCrawlDelay(this, u);
+ delay = crawlDelay > 0 ? crawlDelay : serverDelay;
}
-
- long crawlDelay = robots.getCrawlDelay(this, u);
- long delay = crawlDelay > 0 ? crawlDelay : serverDelay;
if (checkBlocking && maxCrawlDelay >= 0 && delay > maxCrawlDelay) {
// skip this page, otherwise the thread would block for too long.
LOGGER.info("Skipping: " + u + " exceeds fetcher.max.crawl.delay, max="