diff options
author | Shinya Maeda <shinya@gitlab.com> | 2018-09-27 18:17:43 +0900 |
---|---|---|
committer | Alessio Caiazza <acaiazza@gitlab.com> | 2018-10-02 17:08:12 +0200 |
commit | 587560757faaedb6c61ef7aa77f11934cb76084b (patch) | |
tree | 4504e3cd7d5135ba2b65301268cdc6d8dff8134e /app/workers | |
parent | 71fc37c9cf8aee5de3d4d43ec6ea97a56e34537d (diff) | |
download | gitlab-ce-587560757faaedb6c61ef7aa77f11934cb76084b.tar.gz |
Fix StuckCiJobsWorker and added tests
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/stuck_ci_jobs_worker.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/app/workers/stuck_ci_jobs_worker.rb b/app/workers/stuck_ci_jobs_worker.rb index ab090b96c52..821ea75703f 100644 --- a/app/workers/stuck_ci_jobs_worker.rb +++ b/app/workers/stuck_ci_jobs_worker.rb @@ -68,7 +68,7 @@ class StuckCiJobsWorker # `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 # filter `scheduled_at < ?` will only perform on a small subset (max: 100 rows) - Ci::Build.include(EachBatch).where('scheduled_at <> NULL').each_batch(of: 100) do |relation| + Ci::Build.include(EachBatch).where('scheduled_at IS NOT NULL').each_batch(of: 100) do |relation| relation.where('scheduled_at < ?', BUILD_SCHEDULED_OUTDATED_TIMEOUT.ago).find_each do |build| drop_build(:outdated, build, :scheduled, BUILD_SCHEDULED_OUTDATED_TIMEOUT, :schedule_expired) end |