Skip to content

Commit 29732d5

Browse files
committed
Tame dead link checker, again
1 parent 511f37c commit 29732d5

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

site-validation/external-links.test.js

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,9 @@ describe("site external links", () => {
3838
}
3939

4040
// Some APIs give 429s but no retry-after header, and linkinator will not retry in that case
41-
// Retry the hard way
42-
if (!retryWorked && result.status === status.TOO_MANY_REQUESTS) {
43-
retryWorked = await retryUrl(result.url)
44-
}
41+
// However, retrying all those links can make the build epically slow, and a true 404 would turn up on a subsequent run, so err on the side of assuming the links are valid
4542

46-
if (!retryWorked && !isPaywalled) {
43+
if (!retryWorked && !result.status === status.TOO_MANY_REQUESTS && !isPaywalled) {
4744
const errorText =
4845
result.failureDetails[0].statusText || result.failureDetails[0].code
4946
const description = `${result.url} => ${result.status} (${errorText}) on ${result.parent}`
@@ -57,11 +54,8 @@ describe("site external links", () => {
5754
if (!deadExternalLinks.includes(description)) {
5855
deadExternalLinks.push(description)
5956

60-
console.log("Dead link!", description)
61-
6257
// Also write out to a file - the a+ flag will create it if it doesn't exist
6358
const content = JSON.stringify({ url: result.url, owningPage: result.parent }) + "\n"
64-
console.log("Writing", content)
6559

6660
await fs.writeFile(resultsFile, content, { flag: "a+" }, err => {
6761
console.warn("Error writing results:", err)

0 commit comments

Comments
 (0)