Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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