Commit caa2f628 authored by Allison Browne's avatar Allison Browne

Remove `drop(:running..` due to query plan issues

Address backend reviewer feedback
parent 314b7edb
...@@ -23,28 +23,28 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker ...@@ -23,28 +23,28 @@ class StuckCiJobsWorker # rubocop:disable Scalability/IdempotentWorker
drop( drop(
status: :running, status: :running,
search_condition: 'ci_builds.created_at < ? AND updated_at < ?', search_condition: 'ci_builds.updated_at < ?',
search_condition_params: [BUILD_RUNNING_OUTDATED_TIMEOUT.ago, BUILD_RUNNING_OUTDATED_TIMEOUT.ago], search_condition_params: [BUILD_RUNNING_OUTDATED_TIMEOUT.ago],
failure_reason: :stuck_or_timeout_failure failure_reason: :stuck_or_timeout_failure
) )
drop( drop(
status: :pending, status: :pending,
search_condition: 'ci_builds.created_at < ? AND updated_at < ?', search_condition: 'ci_builds.created_at < ? AND ci_builds.updated_at < ?',
search_condition_params: [BUILD_PENDING_OUTDATED_TIMEOUT.ago, BUILD_PENDING_OUTDATED_TIMEOUT.ago], search_condition_params: [BUILD_PENDING_OUTDATED_TIMEOUT.ago, BUILD_PENDING_OUTDATED_TIMEOUT.ago],
failure_reason: :stuck_or_timeout_failure failure_reason: :stuck_or_timeout_failure
) )
drop( drop(
status: :scheduled, status: :scheduled,
search_condition: 'scheduled_at IS NOT NULL AND scheduled_at < ?', search_condition: 'ci_builds.scheduled_at IS NOT NULL AND ci_builds.scheduled_at < ?',
search_condition_params: [BUILD_SCHEDULED_OUTDATED_TIMEOUT.ago], search_condition_params: [BUILD_SCHEDULED_OUTDATED_TIMEOUT.ago],
failure_reason: :stale_schedule failure_reason: :stale_schedule
) )
drop_stuck( drop_stuck(
status: :pending, status: :pending,
search_condition: 'ci_builds.created_at < ? AND updated_at < ?', search_condition: 'ci_builds.created_at < ? AND ci_builds.updated_at < ?',
search_condition_params: [BUILD_PENDING_STUCK_TIMEOUT.ago, BUILD_PENDING_STUCK_TIMEOUT.ago], search_condition_params: [BUILD_PENDING_STUCK_TIMEOUT.ago, BUILD_PENDING_STUCK_TIMEOUT.ago],
failure_reason: :stuck_or_timeout_failure failure_reason: :stuck_or_timeout_failure
) )
......
...@@ -178,19 +178,9 @@ RSpec.describe StuckCiJobsWorker do ...@@ -178,19 +178,9 @@ RSpec.describe StuckCiJobsWorker do
context 'when job was updated in less than 1 hour ago' do context 'when job was updated in less than 1 hour ago' do
let(:updated_at) { 30.minutes.ago } let(:updated_at) { 30.minutes.ago }
context 'when created_at is the same as updated_at' do
let(:created_at) { 30.minutes.ago }
it_behaves_like 'job is unchanged'
end
context 'when created_at is before updated_at' do
let(:created_at) { 30.minutes.ago }
it_behaves_like 'job is unchanged' it_behaves_like 'job is unchanged'
end end
end end
end
%w(success skipped failed canceled).each do |status| %w(success skipped failed canceled).each do |status|
context "when job is #{status}" do context "when job is #{status}" do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment