Skip to content

Commit

Permalink
Merge pull request #443 from gocardless/benwh/instance-destroy-order
Browse files Browse the repository at this point in the history
Fix order of operations when destroying instance
  • Loading branch information
dyson authored Feb 7, 2022
2 parents f9f12db + b8905db commit fa87408
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DRAUPNIR_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
5.2.1
5.2.2
8 changes: 4 additions & 4 deletions pkg/server/api/routes/instances.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,14 +257,14 @@ func (i Instances) Destroy(w http.ResponseWriter, r *http.Request) error {
}

logger.With("instance", id).Info("destroying instance")
err = i.InstanceStore.Destroy(instance)
err = i.Executor.DestroyInstance(r.Context(), instance.ID)
if err != nil {
return errors.Wrap(err, "failed to destroy instance")
return errors.Wrap(err, "failed to destroy instance on disk")
}

err = i.Executor.DestroyInstance(r.Context(), instance.ID)
err = i.InstanceStore.Destroy(instance)
if err != nil {
return errors.Wrap(err, "failed to destroy instance")
return errors.Wrap(err, "failed to remove instance from table")
}

// Destroying the instance will cascade and destroy any linked whitelisted
Expand Down

0 comments on commit fa87408

Please sign in to comment.