Skip to content

Commit 09484d4

Browse files
committed
(#122) Dead Link Checker: add an exception map
1 parent 3e4ee02 commit 09484d4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

check-dead-links.fsx

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ open Markdig.Syntax
1111
open Markdig.Syntax.Inlines
1212
open Polly
1313
open Polly.Retry
14-
open Polly.Timeout
1514

1615
let rec visitRecursively (action: MarkdownObject -> unit) (node: MarkdownObject) =
1716
match node with
@@ -37,6 +36,10 @@ let collectLinks node =
3736
node
3837
urls
3938

39+
let exclusionCodes = Map.ofArray [|
40+
"https://www.lkokemohr.de/fsharp_godot.html", HttpStatusCode.TooManyRequests // GitHub runner receives this often
41+
|]
42+
4043
let printLock = Object()
4144
let retryPipeline =
4245
ResiliencePipelineBuilder()
@@ -49,7 +52,10 @@ let checkLinkStatus (client: HttpClient) (url: string) = task {
4952
fun _ -> ValueTask<HttpResponseMessage>(client.GetAsync url)
5053
)
5154
if response.StatusCode <> HttpStatusCode.OK then
52-
return Result.Error $"Status code {int response.StatusCode}."
55+
return
56+
match Map.tryFind url exclusionCodes with
57+
| Some code when code = response.StatusCode -> Result.Ok()
58+
| _ -> Result.Error $"Status code {int response.StatusCode}."
5359
else
5460
return Result.Ok()
5561
with

0 commit comments

Comments
 (0)