Skip to content

Commit

Permalink
set failed URL retry to 5 by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ikreymer committed Jan 18, 2025
1 parent 5d9c62e commit 5961a52
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/crawler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1921,7 +1921,7 @@ self.__bx_behaviors.selectMainBehavior();
} else if (!downloadResponse) {
// log if not already log and rethrow, consider page failed
if (msg !== "logged") {
logger.error("Page Load Failed, skipping page", {
logger.error("Page Load Failed, will retry", {
msg,
loadState: data.loadState,
...logDetails,
Expand Down
1 change: 1 addition & 0 deletions src/util/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const ADD_LINK_FUNC = "__bx_addLink";
export const FETCH_FUNC = "__bx_fetch";

export const MAX_DEPTH = 1000000;
export const MAX_RETRY_FAILED = 5;

export const FETCH_HEADERS_TIMEOUT_SECS = 30;
export const PAGE_OP_TIMEOUT_SECS = 5;
Expand Down
6 changes: 3 additions & 3 deletions src/util/state.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { v4 as uuidv4 } from "uuid";

import { logger } from "./logger.js";

import { MAX_DEPTH } from "./constants.js";
import { MAX_DEPTH, MAX_RETRY_FAILED } from "./constants.js";
import { ScopedSeed } from "./seeds.js";
import { Frame } from "puppeteer-core";

Expand Down Expand Up @@ -170,7 +170,7 @@ export type SaveState = {
// ============================================================================
export class RedisCrawlState {
redis: Redis;
maxRetryPending = 1;
maxRetryPending = MAX_RETRY_FAILED;

uid: string;
key: string;
Expand Down Expand Up @@ -608,7 +608,7 @@ return inx;
}

if (retryFailed) {
logger.debug("Retring failed URL", { url: data.url }, "state");
logger.debug("Retrying failed URL", { url: data.url }, "state");
}

await this.markStarted(data.url);
Expand Down

0 comments on commit 5961a52

Please sign in to comment.