When multiple containers in a tree need updates, this is effectively
top-down order, which is more efficient. The topmost update will
update the whole tree anyway, so updating subtrees first would be a
waste.
Arvados-DCO-1.1-Signed-off-by: Tom Clegg <tom@curii.com>
WHERE containers.state IN ('Queued', 'Locked', 'Running')
AND containers.priority = 0
AND (parent.uuid IS NULL OR parent.priority > 0)
+ ORDER BY containers.created_at
LIMIT 1`).Scan(&uuid)
if err == sql.ErrNoRows {
break