Skip to content

Commit 03a2c06

Browse files
committed
fixup
1 parent 8699c5a commit 03a2c06

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

models/actions/task.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,9 +260,12 @@ func CreateTaskForRunner(ctx context.Context, runner *ActionRunner) (*ActionTask
260260
for page := 0; job == nil; page++ {
261261
var jobs []*ActionRunJob
262262
// Load only 10 job in a batch without all fields for memory / db load reduction
263-
if err := e.Where("task_id=? AND status=? AND updated>=?", 0, StatusWaiting, lastUpdated).Cols("id", "runs_on").And(jobCond).Asc("updated", "id").Limit(limit).Find(&jobs); err != nil {
263+
if err := e.Where("task_id=? AND status=? AND updated>?", 0, StatusWaiting, lastUpdated).Cols("id", "runs_on").And(jobCond).Asc("updated", "id").Limit(limit).Find(&jobs); err != nil {
264264
return nil, false, err
265265
}
266+
if len(jobs) == 0 {
267+
break
268+
}
266269

267270
// TODO: a more efficient way to filter labels
268271
log.Trace("runner labels: %v", runner.AgentLabels)

0 commit comments

Comments
 (0)