Skip to content

Commit

Permalink
Merge pull request #877 from SSWConsulting/rename-user-agent-and-add-…
Browse files Browse the repository at this point in the history
…maxthread

Renamed User Agent and Added default maxthread to Go
  • Loading branch information
tombui99 authored May 1, 2024
2 parents 222e75a + fe1114c commit 139714c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
5 changes: 4 additions & 1 deletion docker/sswlinkauditor.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func getClient() *http.Client {

func addClientHeaders(r *http.Request) {
if r != nil {
r.Header.Add("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36")
r.Header.Add("User-Agent", "Mozilla/5.0 (compatible; SSWCodeAuditor; +https://codeauditor.com/)")
r.Header.Set("Cache-Control", "no-cache")
r.Header.Set("Connection", "keep-alive")
r.Header.Set("Accept-Encoding", "*")
Expand Down Expand Up @@ -336,6 +336,9 @@ func main() {
allUrls[status.url] = status
}

// Pause for 3 milliseconds before each job completes
time.Sleep(3 * time.Millisecond)

}

elapse := time.Since(start)
Expand Down
2 changes: 1 addition & 1 deletion docker/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ exports.runBrokenLinkCheck = (url, maxthread) => {
try {
const comand = maxthread
? `./sswlinkauditor ${url} ${maxthread}`
: `./sswlinkauditor ${url}`;
: `./sswlinkauditor ${url} 100`; // Default maxthread to 100 (Golang default is 10000)
return [execSync(comand, { maxBuffer: 20000 * 1024 }).toString(), null];
} catch (error) {
return [null, error.message];
Expand Down

0 comments on commit 139714c

Please sign in to comment.