-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
🐛 Fix task group update. #645
Conversation
Signed-off-by: Jeff Ortel <jortel@redhat.com>
}) | ||
return | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: Since the update of a Ready task effectively submits it which creates all of the tasks, this check ensure the tasks are not created more than once.
Signed-off-by: Jeff Ortel <jortel@redhat.com>
@@ -221,17 +230,16 @@ func (h TaskGroupHandler) Update(ctx *gin.Context) { | |||
for i := range m.Tasks { | |||
task := &tasking.Task{} | |||
task.With(&m.Tasks[i]) | |||
err = rtx.TaskManager.Update(h.DB(ctx), task) | |||
err = rtx.TaskManager.Create(h.DB(ctx), task) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: main fix. should be creating the tasks, not updating them.
@@ -172,7 +173,7 @@ func (m *Manager) Update(db *gorm.DB, requested *Task) (err error) { | |||
if err != nil { | |||
return | |||
} | |||
switch requested.State { | |||
switch task.State { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hint: conditional logic should be based on fetched task.
Fix task group submit.
Update to follow error reporting pattern.