Resolved Task Limit error in Flamenco Manager #104201 #104205

Showing only changes of commit fc1d1a79cd - Show all commits

View File

@ -208,11 +208,19 @@ func (db *DB) StoreAuthoredJob(ctx context.Context, authoredJob job_compilers.Au
} }
deps[i] = depTask deps[i] = depTask
} }
dependenciesbatchsize := 1000
dbTask.Dependencies = deps for j := 0; j < len(deps); j += dependenciesbatchsize {
subQuery := tx.Model(dbTask).Updates(Task{Dependencies: deps}) end := j + dependenciesbatchsize
if subQuery.Error != nil { if end > len(deps) {
return taskError(subQuery.Error, "unable to store dependencies of task %q", authoredTask.UUID) end = len(deps)
}
currentDeps := deps[j:end]
dbTask.Dependencies = currentDeps
tx.Model(&dbTask).Where("UUID = ?", dbTask.UUID)
subQuery := tx.Model(dbTask).Updates(Task{Dependencies: currentDeps})
if subQuery.Error != nil {
return taskError(subQuery.Error, "error with storing dependencies of task %q issue exists in dependencies %d to %d", authoredTask.UUID, j, end)
}
} }
} }