spindle/engine: run DestroyWorkflow when setup fails #426

merged
opened by winter.bsky.social targeting master from winter.bsky.social/core: push-luoyqwkpromz

It's possible for SetupWorkflow to provision resources and also fail, so this makes sense for robustness.

Signed-off-by: Winter winter@winter.cafe

Changed files
+6
spindle
engine
+6
spindle/engine/engine.go
··· 62 // TODO(winter): Should this always set StatusFailed? 63 // In the original, we only do in a subset of cases. 64 l.Error("setting up worklow", "wid", wid, "err", err) 65 dbErr := db.StatusFailed(wid, err.Error(), -1, n) 66 if dbErr != nil { 67 return dbErr
··· 62 // TODO(winter): Should this always set StatusFailed? 63 // In the original, we only do in a subset of cases. 64 l.Error("setting up worklow", "wid", wid, "err", err) 65 + 66 + destroyErr := e.DestroyWorkflow(ctx, wid) 67 + if destroyErr != nil { 68 + l.Error("failed to destroy workflow after setup failure", "error", destroyErr) 69 + } 70 + 71 dbErr := db.StatusFailed(wid, err.Error(), -1, n) 72 if dbErr != nil { 73 return dbErr