fix(refresh): name assumed hosts on article reads, and keep times on a bare 404
Also corrects the doc sentences the feature made false. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
24327ea99b
commit
4ee1bf2d2a
@@ -26,6 +26,12 @@ export interface RefreshArticlesInput {
|
||||
log: (line: string) => void;
|
||||
/** Shared with the source loop, which has usually asked this host already. */
|
||||
requestedHosts: Set<string>;
|
||||
/**
|
||||
* Hosts fetched on a recorded robots permission, shared with the source loop.
|
||||
* The page may have been skipped this cycle while an article is still read, and
|
||||
* that warning must not become conditional (AGENTS.md § Scraping conduct).
|
||||
*/
|
||||
assumedRobots: Set<string>;
|
||||
}
|
||||
|
||||
export function articleUrl(title: string): string {
|
||||
@@ -82,6 +88,7 @@ export async function refreshArticles(
|
||||
await failed(decision.reason);
|
||||
continue;
|
||||
}
|
||||
if (decision.assumedOnForbidden === true) input.assumedRobots.add(HOST);
|
||||
if (input.requestedHosts.has(HOST)) {
|
||||
await input.sleep(decision.crawlDelayMs ?? DEFAULT_HOST_GAP_MS);
|
||||
}
|
||||
@@ -102,7 +109,9 @@ export async function refreshArticles(
|
||||
continue;
|
||||
}
|
||||
|
||||
const answer = status === 200 ? answerOf(body) : status === 404 ? "gone" : "unusable";
|
||||
// Only the API's own `missingtitle` means gone. It says so with a 200, so a
|
||||
// bare 404 is an edge or an outage, and must not cost every row its time.
|
||||
const answer = status === 200 ? answerOf(body) : "unusable";
|
||||
if (answer === "gone") {
|
||||
if (await store.markGone(title, nowIso)) changed += 1;
|
||||
warnings.push(`${label}: the wiki says it does not exist`);
|
||||
|
||||
@@ -328,6 +328,7 @@ export async function runRefresh(
|
||||
timeoutMs: options.timeoutMs,
|
||||
log: options.log,
|
||||
requestedHosts: cycle.requestedHosts,
|
||||
assumedRobots: cycle.assumedRobots,
|
||||
});
|
||||
summary.articlesChanged = result.changed;
|
||||
summary.warnings.push(...result.warnings);
|
||||
|
||||
Reference in New Issue
Block a user