Skip to content

Commit a9eb7d9

Browse files
authored
Panic when dequeuing finished workflow task
1 parent e518e4f commit a9eb7d9

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

backend/redis/workflow.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,21 @@ func (rb *redisBackend) GetWorkflowTask(ctx context.Context) (*task.Workflow, er
100100
newEvents = append(newEvents, event)
101101
}
102102

103+
if instanceState.State == backend.WorkflowStateFinished {
104+
// This should never happen. For now, log information and then panic.
105+
l := rb.Logger().With(
106+
"task_id", instanceTask.ID,
107+
"instance_id", instanceState.Instance.InstanceID)
108+
l.Error("got workflow task for finished workflow instance")
109+
110+
// Log events that lead to this task
111+
for _, event := range newEvents {
112+
l.Error("pending_event", "id", event.ID, "event_type", event.Type.String(), "schedule_event_id", event.ScheduleEventID)
113+
}
114+
115+
panic("Dequeued already finished workflow instance task")
116+
}
117+
103118
return &task.Workflow{
104119
ID: instanceTask.TaskID,
105120
WorkflowInstance: instanceState.Instance,

0 commit comments

Comments
 (0)