Skip to content

Commit 4699f1c

Browse files
committed
Handle HTTP 429 while waiting for instance to be ready
Signed-off-by: Koray Oksay <koray.oksay@gmail.com>
1 parent 8eed15b commit 4699f1c

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

ci/cloudrunners/oci/pkg/oci/ephemeralmachine.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"time"
77

88
"github.com/oracle/oci-go-sdk/v65/core"
9+
"github.com/oracle/oci-go-sdk/v65/common"
910
"k8s.io/klog/v2"
1011
)
1112

@@ -55,6 +56,13 @@ func (m *EphemeralMachine) WaitForInstanceReady(ctx context.Context) error {
5556
}
5657
getInstanceResponse, err := m.computeClient.GetInstance(ctx, getInstanceRequest)
5758
if err != nil {
59+
// Handle rate limiting (429)
60+
if svcErr, ok := common.IsServiceError(err); ok && svcErr.GetHTTPStatusCode() == 429 {
61+
log.Info("rate limited by OCI API, retrying in 20 seconds","instanceID", m.instanceID)
62+
time.Sleep(20 * time.Second)
63+
continue
64+
}
65+
5866
if err := m.Delete(context.Background()); err != nil {
5967
log.Error(err, "deleting machine that failed to create")
6068
}

0 commit comments

Comments
 (0)