Skip to content

Commit

Permalink
Adding timeout if it can;t access the server
Browse files Browse the repository at this point in the history
  • Loading branch information
COMTOP1 committed Dec 23, 2023
1 parent 1f2cf82 commit e8b1ad2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions server/views/websiteCheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ func (v *Views) websiteCheck(endpoint string) bool {
r.Header.Add("Content-Type", "application/x-www-form-urlencoded")
r.Header.Add("Content-Length", strconv.Itoa(len(data.Encode())))

client.Timeout = 10 * time.Second

res, err := client.Do(r)
if err != nil {
log.Printf("failed to send request for website check: %+v", err)
Expand Down

0 comments on commit e8b1ad2

Please sign in to comment.