Skip to content

Commit c41b9e7

Browse files
authored
set rateLimitMaxRetries to 4 instead of infinite #1123)
default to 4 retries to avoid crawls getting stuck retrying rate limited pages indefinitely by default! docs: updated docs to mention new default.
1 parent e594832 commit c41b9e7

4 files changed

Lines changed: 9 additions & 6 deletions

File tree

docs/docs/user-guide/cli-options.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -371,10 +371,10 @@ Options:
371371
--rateLimitTimeout Time in seconds to track rate limite
372372
d count for before resetting
373373
[number] [default: 300]
374-
--rateLimitMaxRetries, --retries If set >=0, number of times to retry
374+
--rateLimitMaxRetries If set >=0, number of times to retry
375375
rate limited pages before marking t
376376
hem as failed. If -1, retry indefini
377-
tely [number] [default: -1]
377+
tely [number] [default: 4]
378378
--rateLimitInterruptCount If >0, threshold for number of rate
379379
limited pages before crawl is consid
380380
ered rate limited and is interrupted

docs/docs/user-guide/rate-limits.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,10 @@ If a site provides a `Retry-After` header, for example with a 429 response, the
2727

2828
## Rate Limit Retry Count
2929

30-
By default, rate limited pages are retried indefinitely, allowing the crawl to possibly complete but at a much slower pace. If the pages are blocked due to auth requirements it may be possible to add a browser profile and restart the crawl, allowing for previously flagged pages to be captured successfully.
30+
By default, rate limited pages are retried 4 times, allowing the crawl to possibly complete but at a much slower pace. If the pages are blocked due to auth requirements it may be possible to add a browser profile and restart the crawl, allowing for previously flagged pages to be captured successfully.
3131

32-
However, it may be desirable to set a total number of retries for pages flagged as rate limited, which can be done
33-
by setting `--rateLimitMaxRetries` to a value >= 0, where 0 implies no retries at all.
32+
It may be desirable to set a total number of retries for pages flagged as rate limited higher or lower, which can be done
33+
by setting `--rateLimitMaxRetries` to a value >= 0, where 0 implies no retries at all, while -1 means retry indefinitely.
3434

3535
## Interrupting Crawl on Rate Limit Threshold
3636

src/util/argParser.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import {
2222
DEFAULT_RATE_LIMIT_RULES,
2323
RATE_LIMIT_TTL_SECS,
2424
RateLimitRule,
25+
DEFAULT_MAX_RATE_LIMIT_RETRIES,
2526
} from "./constants.js";
2627
import { interpolateFilename } from "./storage.js";
2728
import { screenshotTypes } from "./screenshots.js";
@@ -790,7 +791,7 @@ class ArgParser {
790791
describe:
791792
"If set >=0, number of times to retry rate limited pages before marking them as failed. If -1, retry indefinitely",
792793
type: "number",
793-
default: -1,
794+
default: DEFAULT_MAX_RATE_LIMIT_RETRIES,
794795
},
795796

796797
rateLimitInterruptCount: {

src/util/constants.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ export const STATUS_DNS_ERROR = 899;
147147
// Rate Limit Constants
148148
export const RATE_LIMIT_TTL_SECS = 300;
149149

150+
export const DEFAULT_MAX_RATE_LIMIT_RETRIES = 4;
151+
150152
export type RateLimitRule = {
151153
regex: RegExp;
152154
status: number;

0 commit comments

Comments
 (0)