Skip to content

Commit

Permalink
Merge pull request #689 from SSWConsulting/link-check-timeout
Browse files Browse the repository at this point in the history
Add timeout to link check
  • Loading branch information
tombui99 authored Oct 10, 2023
2 parents d222484 + a3762e7 commit fdda7d4
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docker/sswlinkauditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ func getHref(t html.Token) (ok bool, href string) {
func check(link Link, linkch chan LinkStatus, number int) {
fmt.Println("CHEC", number, link.url)

client := &http.Client{}
client := &http.Client{
Timeout: 1 * time.Minute,
}
method := "HEAD"

if isLinkUnscannable(link.url) {
Expand All @@ -74,7 +76,11 @@ func check(link Link, linkch chan LinkStatus, number int) {

func crawl(link Link, ch chan Link, linkch chan LinkStatus, number int) {
fmt.Println("CRAW", number, link.url)
resp, err := http.Get(link.url)

client := &http.Client{
Timeout: 1 * time.Minute,
}
resp, err := client.Get(link.url)

defer func() {
if err != nil {
Expand Down

0 comments on commit fdda7d4

Please sign in to comment.