Skip to content

Commit

Permalink
refactor: const timeouts and add missing max retry
Browse files Browse the repository at this point in the history
Signed-off-by: nabil salah <[email protected]>
  • Loading branch information
Nabil-Salah committed Jan 1, 2025
1 parent 119af94 commit b003d41
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions pkg/perf/publicip/publicip_task.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,8 @@ func getRealPublicIP() (net.IP, error) {
return con, nil
},
}
cl.RetryMax = 5

response, err := cl.Get("https://api.ipify.org/")
if err != nil {
return nil, errors.Join(err, errPublicIPLookup)
Expand Down
5 changes: 4 additions & 1 deletion pkg/provision/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ const (
opPause
// opResume resumes a deployment
opResume
// servers default timeout
defaultHttpTimeout = 10 * time.Second
)

// engineJob is a persisted job instance that is
Expand Down Expand Up @@ -1212,7 +1214,8 @@ func isTwinVerified(twinID uint32) (verified bool, err error) {
request.URL.RawQuery = q.Encode()

cl := retryablehttp.NewClient()
cl.HTTPClient.Timeout = 10 * time.Second
cl.HTTPClient.Timeout = defaultHttpTimeout
cl.RetryMax = 5

response, err := cl.StandardClient().Do(request)
if err != nil {
Expand Down

0 comments on commit b003d41

Please sign in to comment.