fix: update jobs

Signed-off-by: allanice001 <allanice001@gmail.com>
This commit is contained in:
allanice001
2025-12-26 04:47:08 +00:00
parent 7cc447c0f5
commit 865270312c

View File

@@ -211,12 +211,18 @@ func RunClusterAction(db *gorm.DB, jobs *bg.Jobs) http.HandlerFunc {
return return
} }
args := bg.ClusterActionArgs{
OrgID: orgID,
ClusterID: clusterID,
Action: action.MakeTarget,
MakeTarget: action.MakeTarget,
}
// Enqueue with run.ID as the job ID so the worker can look it up. // Enqueue with run.ID as the job ID so the worker can look it up.
_, enqueueErr := jobs.Enqueue( _, enqueueErr := jobs.Enqueue(
r.Context(), r.Context(),
run.ID.String(), run.ID.String(),
"cluster_action", "cluster_action",
bg.ClusterActionWorker, args,
archer.WithMaxRetries(3), archer.WithMaxRetries(3),
) )
@@ -225,7 +231,7 @@ func RunClusterAction(db *gorm.DB, jobs *bg.Jobs) http.HandlerFunc {
Where("id = ?", run.ID). Where("id = ?", run.ID).
Updates(map[string]any{ Updates(map[string]any{
"status": models.ClusterRunStatusFailed, "status": models.ClusterRunStatusFailed,
"error": "failed to enqueue job", "error": "failed to enqueue job: " + enqueueErr.Error(),
"finished_at": time.Now().UTC(), "finished_at": time.Now().UTC(),
}).Error }).Error