Manager, more efficiently create tasks

When creating tasks the inter-task dependencies are saved as a 2nd pass,by
updating the tasks in the database. This now only saves those dependencies,
and no longer saves the entire task again.
This commit is contained in:
Sybren A. Stüvel 2022-06-13 15:26:39 +02:00
parent 02bc03ae2b
commit 6ec493d944

View File

@ -162,8 +162,9 @@ func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.Au
} }
dbTask.Dependencies = deps dbTask.Dependencies = deps
if err := tx.Save(dbTask).Error; err != nil { subQuery := tx.Model(dbTask).Updates(Task{Dependencies: deps})
return taskError(err, "unable to store dependencies of task %q", authoredTask.UUID) if subQuery.Error != nil {
return taskError(subQuery.Error, "unable to store dependencies of task %q", authoredTask.UUID)
} }
} }