Skip to content

Commit

Permalink
feat(baremetal): add RetryInterval variable (#357)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sh4d1 authored Mar 19, 2020
1 parent dd11e52 commit 8db4148
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions api/baremetal/v1alpha1/server_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@ import (
"github.com/scaleway/scaleway-sdk-go/scw"
)

var (
// RetryInterval is needed when running recorded tests (e.g. on scaleway-cli)
// it allows to execute the WaitFor funcs immediately
RetryInterval = defaultRetryInterval
)

const (
defaultRetryInterval = 15 * time.Second
)

// WaitForServerRequest is used by WaitForServer method.
type WaitForServerRequest struct {
ServerID string
Expand Down Expand Up @@ -40,7 +50,7 @@ func (s *API) WaitForServer(req *WaitForServerRequest) (*Server, error) {
return res, isTerminal, err
},
Timeout: req.Timeout,
IntervalStrategy: async.LinearIntervalStrategy(5 * time.Second),
IntervalStrategy: async.LinearIntervalStrategy(RetryInterval),
})
if err != nil {
return nil, errors.Wrap(err, "waiting for server failed")
Expand Down Expand Up @@ -84,7 +94,7 @@ func (s *API) WaitForServerInstall(req *WaitForServerInstallRequest) (*Server, e
return res, isTerminal, err
},
Timeout: req.Timeout,
IntervalStrategy: async.LinearIntervalStrategy(15 * time.Second),
IntervalStrategy: async.LinearIntervalStrategy(RetryInterval),
})
if err != nil {
return nil, errors.Wrap(err, "waiting for server installation failed")
Expand Down

0 comments on commit 8db4148

Please sign in to comment.