Signed-off-by: moshyfawn email@moshyfawn.dev
+7
spindle/db/events.go
+7
spindle/db/events.go
···
77
77
exitCode *int64,
78
78
n *notifier.Notifier,
79
79
) error {
80
+
// don't overwrite a terminal status
81
+
if current, err := d.GetStatus(workflowId); err == nil {
82
+
if models.StatusKind(current.Status).IsFinish() {
83
+
return nil
84
+
}
85
+
}
86
+
80
87
now := time.Now()
81
88
pipelineAtUri := workflowId.PipelineId.AtUri()
82
89
s := tangled.PipelineStatus{
History
2 rounds
2 comments
moshyfawn.dev
submitted
#1
1 commit
expand
collapse
spindle/db: prevent status events from overwriting terminal states
Fixes a race condition where a cancelled pipeline's status could be overwritten by a late-arriving failed status event from a container that was still winding down.
Signed-off-by: moshyfawn <email@moshyfawn.dev>
no conflicts, ready to merge
expand 1 comment
moshyfawn.dev
submitted
#0
1 commit
expand
collapse
spindle/db: prevent status events from overwriting terminal states
Signed-off-by: moshyfawn <email@moshyfawn.dev>
expand 1 comment
This prevents cancelled pipeline runs getting overwritten with a failed status by the workflow goroutine when its container is destroyed
what are some scenarios where this happens? i think the fact this is happening is a side effect of a greater issue: that the final state of a workflow is in fact not the final state, it continues to do things.