Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NUTCH-3011 HttpRobotRulesParser: handle HTTP 429 Too Many Requests same as server errors (HTTP 5xx) #786

Merged
merged 1 commit into from
Oct 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions conf/nutch-default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -141,25 +141,26 @@
<name>http.robots.503.defer.visits</name>
<value>true</value>
<description>Temporarily suspend fetching from a host if the
robots.txt response is HTTP 503 or any other 5xx server error. See
also http.robots.503.defer.visits.delay and
robots.txt response is HTTP 503 or any other 5xx server error
and HTTP 429 Too Many Requests. See also
http.robots.503.defer.visits.delay and
http.robots.503.defer.visits.retries</description>
</property>

<property>
<name>http.robots.503.defer.visits.delay</name>
<value>300000</value>
<description>Time in milliseconds to suspend crawling a host if the
robots.txt response is HTTP 5xx - see
robots.txt response is HTTP 5xx or 429 Too Many Requests - see
http.robots.503.defer.visits.</description>
</property>

<property>
<name>http.robots.503.defer.visits.retries</name>
<value>3</value>
<description>Number of retries crawling a host if the robots.txt
response is HTTP 5xx - see http.robots.503.defer.visits. After n
retries the host queue is dropped for this segment/cycle.
response is HTTP 5xx or 429 - see http.robots.503.defer.visits.
After n retries the host queue is dropped for this segment/cycle.
</description>
</property>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,8 @@ public BaseRobotRules getRobotRulesSet(Protocol http, URL url,
else if ((code == 403) && (!allowForbidden))
robotRules = FORBID_ALL_RULES; // use forbid all

else if (code >= 500) {
else if (code >= 500 || code == 429) {
// 5xx server errors or 429 Too Many Requests
cacheRule = false; // try again later to fetch robots.txt
if (deferVisits503) {
// signal fetcher to suspend crawling for this host
Expand Down
Loading