aboutsummaryrefslogtreecommitdiff
path: root/brokenlinks/worker.go
diff options
context:
space:
mode:
authorShulhan <ms@kilabit.info>2025-07-02 02:07:43 +0700
committerShulhan <ms@kilabit.info>2025-11-20 17:12:19 +0700
commit5301c666eec35699bbb9024678bb37adc057404c (patch)
tree384516772bd4f6fc6cbcd08eea407dda89d4bee8 /brokenlinks/worker.go
parentc5d26d9a6c039816ce8369c34dd5ea33fac660a1 (diff)
downloadjarink-5301c666eec35699bbb9024678bb37adc057404c.tar.xz
brokenlinks: fix infinite loop on unknown host
On link with invalid domain, it should break and return the error immediately.
Diffstat (limited to 'brokenlinks/worker.go')
-rw-r--r--brokenlinks/worker.go7
1 files changed, 5 insertions, 2 deletions
diff --git a/brokenlinks/worker.go b/brokenlinks/worker.go
index 0493a77..3c6f97e 100644
--- a/brokenlinks/worker.go
+++ b/brokenlinks/worker.go
@@ -420,12 +420,12 @@ func (wrk *worker) fetch(linkq linkQueue) (
for retry < 5 {
if linkq.kind == atom.Img {
if wrk.opts.IsVerbose {
- wrk.log.Printf("scan: HEAD %s\n", linkq.url)
+ wrk.log.Printf("fetch: HEAD %s", linkq.url)
}
httpResp, err = wrk.httpc.Head(linkq.url)
} else {
if wrk.opts.IsVerbose {
- wrk.log.Printf("scan: GET %s\n", linkq.url)
+ wrk.log.Printf("fetch: GET %s", linkq.url)
}
httpResp, err = wrk.httpc.Get(linkq.url)
}
@@ -438,7 +438,10 @@ func (wrk *worker) fetch(linkq linkQueue) (
}
if errDNS.Timeout() {
retry++
+ wrk.log.Printf(`fetch %s: %s (%d/%d)`, linkq.url, err, retry, maxRetry)
+ continue
}
+ break
}
return nil, err
}