Fix stuck ci jobs worker
This commit is contained in:
parent
6eee8d2d53
commit
20de2480d2
1 changed files with 1 additions and 1 deletions
|
@ -76,7 +76,7 @@ class StuckCiJobsWorker
|
||||||
# `ci_builds` table has a partial index on `id` with `scheduled_at <> NULL` condition.
|
# `ci_builds` table has a partial index on `id` with `scheduled_at <> NULL` condition.
|
||||||
# Therefore this query's first step uses Index Search, and the following expensive
|
# Therefore this query's first step uses Index Search, and the following expensive
|
||||||
# filter `scheduled_at < ?` will only perform on a small subset (max: 100 rows)
|
# filter `scheduled_at < ?` will only perform on a small subset (max: 100 rows)
|
||||||
Ci::Build.include(EachBach).where('scheduled_at <> NULL').each_batch(of: 100) do |relation|
|
Ci::Build.include(EachBatch).where('scheduled_at <> NULL').each_batch(of: 100) do |relation|
|
||||||
relation.where('scheduled_at < ?', BUILD_SCHEDULED_OUTDATED_TIMEOUT.ago).find_each do |build|
|
relation.where('scheduled_at < ?', BUILD_SCHEDULED_OUTDATED_TIMEOUT.ago).find_each do |build|
|
||||||
drop_build(:outdated, build, :scheduled, BUILD_SCHEDULED_OUTDATED_TIMEOUT, :schedule_expired)
|
drop_build(:outdated, build, :scheduled, BUILD_SCHEDULED_OUTDATED_TIMEOUT, :schedule_expired)
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue