fix(delivery): use unique pending AWX job placeholders

This commit is contained in:
mac
2026-07-27 18:33:33 +08:00
parent 4637228bae
commit 8378427d3d
2 changed files with 6 additions and 2 deletions
+5 -1
View File
@@ -761,7 +761,7 @@ func (s *DeliveryService) CreateExecution(ctx context.Context, taskID, payloadHa
}
// Persist execution record BEFORE launching AWX to ensure crash recovery.
now := time.Now()
execution := model.ExecutionJob{TaskID: task.ID, IdempotencyKey: task.IdempotencyKey, ExecutorJobID: "pending", Status: "launching", StartedAt: &now}
execution := model.ExecutionJob{TaskID: task.ID, IdempotencyKey: task.IdempotencyKey, ExecutorJobID: pendingExecutorJobID(task.ID), Status: "launching", StartedAt: &now}
if err := s.db.WithContext(ctx).Create(&execution).Error; err != nil {
return nil, false, err
}
@@ -1119,3 +1119,7 @@ func (s *DeliveryService) Run(ctx context.Context) {
}
}
}
func pendingExecutorJobID(taskID string) string {
return "pending:" + taskID
}