Skip to content

Commit

Permalink
bugfix: Wait on serve.NextActions to reduce poll count on initial sta…
Browse files Browse the repository at this point in the history
…rtup (closes #119)
  • Loading branch information
JonasProgrammer committed Dec 15, 2023
1 parent c023dd1 commit d97bd3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion driver/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func (d *Driver) Create() error {
d.ServerID = srv.Server.ID
log.Infof(" -> Server %s[%d]: Waiting to come up...", srv.Server.Name, srv.Server.ID)

err = d.waitForRunningServer()
err = d.waitForInitialStartup(srv)
if err != nil {
return err
}
Expand Down
10 changes: 10 additions & 0 deletions driver/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,16 @@ func (d *Driver) waitForRunningServer() error {
return nil
}

func (d *Driver) waitForInitialStartup(srv hcloud.ServerCreateResult) error {
if srv.NextActions != nil && len(srv.NextActions) != 0 {
if err := d.waitForMultipleActions("server.NextActions", srv.NextActions); err != nil {
return fmt.Errorf("could not wait for NextActions: %w", err)
}
}

return d.waitForRunningServer()
}

func (d *Driver) makeCreateServerOptions() (*hcloud.ServerCreateOpts, error) {
pgrp, err := d.getPlacementGroup()
if err != nil {
Expand Down

0 comments on commit d97bd3b

Please sign in to comment.