Manager: fix panic on task timeout
Fix an issue where a timed-out task would cause a panic, as it wasn't fetching its Job UUID. I see this as working around a limitation of GORM, which should get replaced with sqlc soon-ish anyway.
This commit is contained in:
parent
de6aecfe81
commit
f7a1e92e82
@ -37,6 +37,15 @@ func (db *DB) FetchTimedOutTasks(ctx context.Context, untouchedSince time.Time)
|
||||
if tx.Error != nil {
|
||||
return nil, taskError(tx.Error, "finding timed out tasks (untouched since %s)", untouchedSince.String())
|
||||
}
|
||||
|
||||
// GORM apparently doesn't call the task's AfterFind() function for the above query.
|
||||
for _, task := range result {
|
||||
err := task.AfterFind(tx)
|
||||
if err != nil {
|
||||
return nil, taskError(tx.Error, "finding the job & worker UUIDs for task %s", task.UUID)
|
||||
}
|
||||
}
|
||||
|
||||
return result, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user