Skip to content

Commit da002b5

Browse files
committed
clean old waiters
1 parent e449037 commit da002b5

File tree

23 files changed

+0
-2098
lines changed

23 files changed

+0
-2098
lines changed

api/applesilicon/v1alpha1/apple_silicon_utils.go

Lines changed: 0 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -13,53 +13,6 @@ const (
1313
defaultTimeout = 60 * time.Minute
1414
)
1515

16-
// WaitForInstanceRequest is used by WaitForServer method.
17-
type WaitForServerRequest struct {
18-
ServerID string
19-
Zone scw.Zone
20-
Timeout *time.Duration
21-
RetryInterval *time.Duration
22-
}
23-
24-
// WaitForServer waits for the instance to be in a "terminal state" before returning.
25-
// This function can be used to wait for an instance to be ready for example.
26-
func (s *API) WaitForServer(req *WaitForServerRequest, opts ...scw.RequestOption) (*Server, error) {
27-
timeout := defaultTimeout
28-
if req.Timeout != nil {
29-
timeout = *req.Timeout
30-
}
31-
retryInterval := defaultRetryInterval
32-
if req.RetryInterval != nil {
33-
retryInterval = *req.RetryInterval
34-
}
35-
36-
terminalStatus := map[ServerStatus]struct{}{
37-
ServerStatusReady: {},
38-
ServerStatusError: {},
39-
}
40-
41-
server, err := async.WaitSync(&async.WaitSyncConfig{
42-
Get: func() (any, bool, error) {
43-
res, err := s.GetServer(&GetServerRequest{
44-
ServerID: req.ServerID,
45-
Zone: req.Zone,
46-
}, opts...)
47-
if err != nil {
48-
return nil, false, err
49-
}
50-
_, isTerminal := terminalStatus[res.Status]
51-
52-
return res, isTerminal, nil
53-
},
54-
Timeout: timeout,
55-
IntervalStrategy: async.LinearIntervalStrategy(retryInterval),
56-
})
57-
if err != nil {
58-
return nil, errors.Wrap(err, "waiting for server failed")
59-
}
60-
return server.(*Server), nil
61-
}
62-
6316
func (s *PrivateNetworkAPI) WaitForServerPrivateNetworks(req *WaitForServerRequest, opts ...scw.RequestOption) ([]*ServerPrivateNetwork, error) {
6417
timeout := defaultTimeout
6518
if req.Timeout != nil {

api/baremetal/v1/server_utils.go

Lines changed: 0 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -13,57 +13,6 @@ const (
1313
defaultTimeout = 2 * time.Hour
1414
)
1515

16-
// WaitForServerRequest is used by WaitForServer method.
17-
type WaitForServerRequest struct {
18-
ServerID string
19-
Zone scw.Zone
20-
Timeout *time.Duration
21-
RetryInterval *time.Duration
22-
}
23-
24-
// WaitForServer wait for the server to be in a "terminal state" before returning.
25-
// This function can be used to wait for a server to be created.
26-
func (s *API) WaitForServer(req *WaitForServerRequest, opts ...scw.RequestOption) (*Server, error) {
27-
timeout := defaultTimeout
28-
if req.Timeout != nil {
29-
timeout = *req.Timeout
30-
}
31-
retryInterval := defaultRetryInterval
32-
if req.RetryInterval != nil {
33-
retryInterval = *req.RetryInterval
34-
}
35-
36-
terminalStatus := map[ServerStatus]struct{}{
37-
ServerStatusReady: {},
38-
ServerStatusStopped: {},
39-
ServerStatusError: {},
40-
ServerStatusLocked: {},
41-
ServerStatusUnknown: {},
42-
}
43-
44-
server, err := async.WaitSync(&async.WaitSyncConfig{
45-
Get: func() (any, bool, error) {
46-
res, err := s.GetServer(&GetServerRequest{
47-
ServerID: req.ServerID,
48-
Zone: req.Zone,
49-
}, opts...)
50-
if err != nil {
51-
return nil, false, err
52-
}
53-
54-
_, isTerminal := terminalStatus[res.Status]
55-
return res, isTerminal, err
56-
},
57-
Timeout: timeout,
58-
IntervalStrategy: async.LinearIntervalStrategy(retryInterval),
59-
})
60-
if err != nil {
61-
return nil, errors.Wrap(err, "waiting for server failed")
62-
}
63-
64-
return server.(*Server), nil
65-
}
66-
6716
// WaitForServerInstallRequest is used by WaitForServerInstall method.
6817
type WaitForServerInstallRequest struct {
6918
ServerID string

api/container/v1beta1/container_helpers.go

Lines changed: 0 additions & 257 deletions
This file was deleted.

0 commit comments

Comments
 (0)