Skip to content

Commit

Permalink
deleteInstance use etag
Browse files Browse the repository at this point in the history
  • Loading branch information
gamoutatsumi committed Apr 16, 2024
1 parent 36ac3b8 commit a9ea052
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions pool-agent/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pool-agent
6 changes: 5 additions & 1 deletion pool-agent/cmd/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,11 @@ func (a *Agent) deleteInstance(i api.Instance) error {
}
a.deletingInstances[i.Name] = struct{}{}
defer delete(a.deletingInstances, i.Name)
stopOp, err := a.Client.UpdateInstanceState(i.Name, api.InstanceStatePut{Action: "stop", Timeout: -1, Force: true}, "")
_, etag, err := a.Client.GetInstance(i.Name)
if err != nil {
return fmt.Errorf("get instance %q: %w", i.Name, err)
}
stopOp, err := a.Client.UpdateInstanceState(i.Name, api.InstanceStatePut{Action: "stop", Timeout: -1, Force: true}, etag)
if err != nil {
return fmt.Errorf("failed to stop instance %q: %+v", i.Name, err)
}
Expand Down

0 comments on commit a9ea052

Please sign in to comment.