Skip to content

Commit

Permalink
Fix queue ordering.
Browse files Browse the repository at this point in the history
  • Loading branch information
Alessandro Degano committed Nov 29, 2019
1 parent 95f8447 commit bebda25
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions atc/db/task_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,9 @@ func (queue *taskQueue) Position(id string) (position int, err error) {
return 0, err
}
}
tasks_positions := psql.Select("row_number() over (), id").
tasks_positions := psql.Select("row_number() over (order by insert_time), id").
From("tasks_queue").
Where(sq.Eq{"platform": platform, "team_id": teamId, "worker_tag": workerTag}).
OrderBy("insert_time")
Where(sq.Eq{"platform": platform, "team_id": teamId, "worker_tag": workerTag})
err = psql.Select("row_number").
FromSelect(tasks_positions, "subq").
Where(sq.Eq{"id": id}).
Expand Down

0 comments on commit bebda25

Please sign in to comment.