Skip to content

Commit

Permalink
skip launch when creating or updating spot machines
Browse files Browse the repository at this point in the history
  • Loading branch information
dangra committed Jul 26, 2024
1 parent 2dfa590 commit 15a93a4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions internal/command/deploy/machines_launchinput.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,8 @@ func skipLaunch(origMachineRaw *fly.Machine, mConfig *fly.MachineConfig) bool {
return true
}
}
case mConfig.Restart != nil && mConfig.Restart.Policy == fly.MachineRestartPolicySpotPrice:
return true
}
return false
}
5 changes: 4 additions & 1 deletion internal/command/machine/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -409,8 +409,11 @@ func runMachineRun(ctx context.Context) error {
return nil
}

input.SkipLaunch = (len(machineConf.Standbys) > 0 || isCreate)
input.Config = machineConf
input.SkipLaunch = (len(machineConf.Standbys) > 0 || isCreate)
if machineConf.Restart != nil && machineConf.Restart.Policy == fly.MachineRestartPolicySpotPrice {
input.SkipLaunch = true
}

machine, err := flapsClient.Launch(ctx, input)
if err != nil {
Expand Down

0 comments on commit 15a93a4

Please sign in to comment.