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
+5
spindle
engine
+5
spindle/engine/engine.go
··· 54 54 // In the original, we only do in a subset of cases. 55 55 l.Error("setting up worklow", "wid", wid, "err", err) 56 56 57 + destroyErr := eng.DestroyWorkflow(ctx, wid) 58 + if destroyErr != nil { 59 + l.Error("failed to destroy workflow after setup failure", "error", destroyErr) 60 + } 61 + 57 62 dbErr := db.StatusFailed(wid, err.Error(), -1, n) 58 63 if dbErr != nil { 59 64 return dbErr