Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 580678d

Browse files
committed
drivers/digitalocean: Increase ip assignment performance
Signed-off-by: 243083df <243083df@dispostable.com>
1 parent f748ac1 commit 580678d

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

drivers/digitalocean/digitalocean.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -243,21 +243,19 @@ func (d *Driver) Create() error {
243243
d.DropletID = newDroplet.ID
244244

245245
log.Info("Waiting for IP address to be assigned to the Droplet...")
246+
IpAssignLoop:
246247
for {
247248
newDroplet, _, err = client.Droplets.Get(context.TODO(), d.DropletID)
248249
if err != nil {
249250
return err
250251
}
251252
for _, network := range newDroplet.Networks.V4 {
252-
if network.Type == "public" {
253+
if network.Type == "public" && network.IPAddress != "" {
253254
d.IPAddress = network.IPAddress
255+
break IpAssignLoop
254256
}
255257
}
256258

257-
if d.IPAddress != "" {
258-
break
259-
}
260-
261259
time.Sleep(1 * time.Second)
262260
}
263261

0 commit comments

Comments
 (0)