Commit aae855a1 authored by Sean Arnold's avatar Sean Arnold

Rename workers to fit naming scheme

- Use IncidentManagement::PendingEscalations prefix
parent b37910ec
...@@ -647,7 +647,7 @@ Gitlab.ee do ...@@ -647,7 +647,7 @@ Gitlab.ee do
Settings.cron_jobs['incident_management_persist_oncall_rotation_worker']['job_class'] = 'IncidentManagement::OncallRotations::PersistAllRotationsShiftsJob' Settings.cron_jobs['incident_management_persist_oncall_rotation_worker']['job_class'] = 'IncidentManagement::OncallRotations::PersistAllRotationsShiftsJob'
Settings.cron_jobs['incident_management_schedule_escalation_check_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['incident_management_schedule_escalation_check_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['incident_management_schedule_escalation_check_worker']['cron'] ||= '*/1 * * * *' Settings.cron_jobs['incident_management_schedule_escalation_check_worker']['cron'] ||= '*/1 * * * *'
Settings.cron_jobs['incident_management_schedule_escalation_check_worker']['job_class'] = 'IncidentManagement::Escalations::ScheduleEscalationCheckCronWorker' Settings.cron_jobs['incident_management_schedule_escalation_check_worker']['job_class'] = 'IncidentManagement::PendingEscalations::ScheduleCheckCronWorker'
Settings.cron_jobs['import_software_licenses_worker'] ||= Settingslogic.new({}) Settings.cron_jobs['import_software_licenses_worker'] ||= Settingslogic.new({})
Settings.cron_jobs['import_software_licenses_worker']['cron'] ||= '0 3 * * 0' Settings.cron_jobs['import_software_licenses_worker']['cron'] ||= '0 3 * * 0'
Settings.cron_jobs['import_software_licenses_worker']['job_class'] = 'ImportSoftwareLicensesWorker' Settings.cron_jobs['import_software_licenses_worker']['job_class'] = 'ImportSoftwareLicensesWorker'
......
...@@ -180,10 +180,10 @@ ...@@ -180,10 +180,10 @@
- 2 - 2
- - incident_management_apply_incident_sla_exceeded_label - - incident_management_apply_incident_sla_exceeded_label
- 1 - 1
- - incident_management_escalations_pending_alert_escalation_check
- 1
- - incident_management_oncall_rotations_persist_shifts_job - - incident_management_oncall_rotations_persist_shifts_job
- 1 - 1
- - incident_management_pending_escalations_alert_check
- 1
- - invalid_gpg_signature_update - - invalid_gpg_signature_update
- 2 - 2
- - irker - - irker
......
...@@ -52,7 +52,7 @@ module IncidentManagement ...@@ -52,7 +52,7 @@ module IncidentManagement
def process_escalations(escalation_ids) def process_escalations(escalation_ids)
args = escalation_ids.map { |id| [id] } args = escalation_ids.map { |id| [id] }
::IncidentManagement::Escalations::PendingAlertEscalationCheckWorker.bulk_perform_async(args) # rubocop:disable Scalability/BulkPerformWithContext ::IncidentManagement::PendingEscalations::AlertCheckWorker.bulk_perform_async(args) # rubocop:disable Scalability/BulkPerformWithContext
end end
end end
end end
......
...@@ -294,15 +294,6 @@ ...@@ -294,15 +294,6 @@
:weight: 1 :weight: 1
:idempotent: :idempotent:
:tags: [] :tags: []
- :name: cronjob:incident_management_escalations_schedule_escalation_check_cron
:worker_name: IncidentManagement::Escalations::ScheduleEscalationCheckCronWorker
:feature_category: :incident_management
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent: true
:tags: []
- :name: cronjob:incident_management_incident_sla_exceeded_check - :name: cronjob:incident_management_incident_sla_exceeded_check
:worker_name: IncidentManagement::IncidentSlaExceededCheckWorker :worker_name: IncidentManagement::IncidentSlaExceededCheckWorker
:feature_category: :incident_management :feature_category: :incident_management
...@@ -323,6 +314,15 @@ ...@@ -323,6 +314,15 @@
:idempotent: true :idempotent: true
:tags: :tags:
- :exclude_from_kubernetes - :exclude_from_kubernetes
- :name: cronjob:incident_management_pending_escalations_schedule_check_cron
:worker_name: IncidentManagement::PendingEscalations::ScheduleCheckCronWorker
:feature_category: :incident_management
:has_external_dependencies:
:urgency: :low
:resource_boundary: :unknown
:weight: 1
:idempotent: true
:tags: []
- :name: cronjob:iterations_cadences_create_iterations - :name: cronjob:iterations_cadences_create_iterations
:worker_name: Iterations::Cadences::CreateIterationsWorker :worker_name: Iterations::Cadences::CreateIterationsWorker
:feature_category: :issue_tracking :feature_category: :issue_tracking
...@@ -1053,15 +1053,6 @@ ...@@ -1053,15 +1053,6 @@
:idempotent: true :idempotent: true
:tags: :tags:
- :exclude_from_kubernetes - :exclude_from_kubernetes
- :name: incident_management_escalations_pending_alert_escalation_check
:worker_name: IncidentManagement::Escalations::PendingAlertEscalationCheckWorker
:feature_category: :incident_management
:has_external_dependencies:
:urgency: :high
:resource_boundary: :unknown
:weight: 1
:idempotent: true
:tags: []
- :name: incident_management_oncall_rotations_persist_shifts_job - :name: incident_management_oncall_rotations_persist_shifts_job
:worker_name: IncidentManagement::OncallRotations::PersistShiftsJob :worker_name: IncidentManagement::OncallRotations::PersistShiftsJob
:feature_category: :incident_management :feature_category: :incident_management
...@@ -1072,6 +1063,15 @@ ...@@ -1072,6 +1063,15 @@
:idempotent: true :idempotent: true
:tags: :tags:
- :exclude_from_kubernetes - :exclude_from_kubernetes
- :name: incident_management_pending_escalations_alert_check
:worker_name: IncidentManagement::PendingEscalations::AlertCheckWorker
:feature_category: :incident_management
:has_external_dependencies:
:urgency: :high
:resource_boundary: :unknown
:weight: 1
:idempotent: true
:tags: []
- :name: ldap_group_sync - :name: ldap_group_sync
:worker_name: LdapGroupSyncWorker :worker_name: LdapGroupSyncWorker
:feature_category: :authentication_and_authorization :feature_category: :authentication_and_authorization
......
# frozen_string_literal: true # frozen_string_literal: true
module IncidentManagement module IncidentManagement
module Escalations module PendingEscalations
class PendingAlertEscalationCheckWorker class AlertCheckWorker
include ApplicationWorker include ApplicationWorker
urgency :high urgency :high
...@@ -10,19 +10,11 @@ module IncidentManagement ...@@ -10,19 +10,11 @@ module IncidentManagement
idempotent! idempotent!
feature_category :incident_management feature_category :incident_management
def initialize(escalation_id) def perform(escalation_id)
@escalation_id = escalation_id
end
def perform
escalation = IncidentManagement::PendingEscalations::Alert.find(escalation_id) escalation = IncidentManagement::PendingEscalations::Alert.find(escalation_id)
IncidentManagement::PendingEscalations::ProcessService.new(escalation).execute IncidentManagement::PendingEscalations::ProcessService.new(escalation).execute
end end
private
attr_reader :escalation_id
end end
end end
end end
# frozen_string_literal: true # frozen_string_literal: true
module IncidentManagement module IncidentManagement
module Escalations module PendingEscalations
class ScheduleEscalationCheckCronWorker class ScheduleCheckCronWorker
include ApplicationWorker include ApplicationWorker
# This worker does not perform work scoped to a context # This worker does not perform work scoped to a context
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
...@@ -13,7 +13,7 @@ module IncidentManagement ...@@ -13,7 +13,7 @@ module IncidentManagement
def perform def perform
::IncidentManagement::PendingEscalations::Alert.processable.each_batch do |relation| ::IncidentManagement::PendingEscalations::Alert.processable.each_batch do |relation|
args = relation.pluck(:id).map { |id| [id] } # rubocop:disable CodeReuse/ActiveRecord args = relation.pluck(:id).map { |id| [id] } # rubocop:disable CodeReuse/ActiveRecord
::IncidentManagement::Escalations::PendingAlertEscalationCheckWorker.bulk_perform_async(args) # rubocop:disable Scalability/BulkPerformWithContext ::IncidentManagement::PendingEscalations::AlertCheckWorker.bulk_perform_async(args) # rubocop:disable Scalability/BulkPerformWithContext
end end
end end
end end
......
...@@ -54,7 +54,7 @@ RSpec.describe IncidentManagement::PendingEscalations::CreateService do ...@@ -54,7 +54,7 @@ RSpec.describe IncidentManagement::PendingEscalations::CreateService do
end end
it 'creates the escalations and queues the escalation process check' do it 'creates the escalations and queues the escalation process check' do
expect(IncidentManagement::Escalations::PendingAlertEscalationCheckWorker) expect(IncidentManagement::PendingEscalations::AlertCheckWorker)
.to receive(:bulk_perform_async) .to receive(:bulk_perform_async)
.with([[a_kind_of(Integer)], [a_kind_of(Integer)]]) .with([[a_kind_of(Integer)], [a_kind_of(Integer)]])
......
...@@ -11,7 +11,7 @@ RSpec.shared_examples 'creates an escalation' do |count| ...@@ -11,7 +11,7 @@ RSpec.shared_examples 'creates an escalation' do |count|
expected_args = [] expected_args = []
count.times { expected_args << [a_kind_of(Integer)]} count.times { expected_args << [a_kind_of(Integer)]}
expect(IncidentManagement::Escalations::PendingAlertEscalationCheckWorker) expect(IncidentManagement::PendingEscalations::AlertCheckWorker)
.to receive(:bulk_perform_async) .to receive(:bulk_perform_async)
.with(expected_args) .with(expected_args)
......
...@@ -2,13 +2,13 @@ ...@@ -2,13 +2,13 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe IncidentManagement::Escalations::PendingAlertEscalationCheckWorker do RSpec.describe IncidentManagement::PendingEscalations::AlertCheckWorker do
let(:worker) { described_class.new(escalation.id) } let(:worker) { described_class.new }
let_it_be(:escalation) { create(:incident_management_pending_alert_escalation) } let_it_be(:escalation) { create(:incident_management_pending_alert_escalation) }
describe '#perform' do describe '#perform' do
subject { worker.perform } subject { worker.perform(escalation.id) }
it 'processes the escalation' do it 'processes the escalation' do
process_service = spy(IncidentManagement::PendingEscalations::ProcessService) process_service = spy(IncidentManagement::PendingEscalations::ProcessService)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
require 'spec_helper' require 'spec_helper'
RSpec.describe IncidentManagement::Escalations::ScheduleEscalationCheckCronWorker do RSpec.describe IncidentManagement::PendingEscalations::ScheduleCheckCronWorker do
let(:worker) { described_class.new } let(:worker) { described_class.new }
let_it_be(:escalation_1) { create(:incident_management_pending_alert_escalation, process_at: 5.minutes.ago) } let_it_be(:escalation_1) { create(:incident_management_pending_alert_escalation, process_at: 5.minutes.ago) }
...@@ -13,7 +13,7 @@ RSpec.describe IncidentManagement::Escalations::ScheduleEscalationCheckCronWorke ...@@ -13,7 +13,7 @@ RSpec.describe IncidentManagement::Escalations::ScheduleEscalationCheckCronWorke
subject { worker.perform } subject { worker.perform }
it 'schedules a job for each processable escalation' do it 'schedules a job for each processable escalation' do
expect(IncidentManagement::Escalations::PendingAlertEscalationCheckWorker).to receive(:bulk_perform_async) expect(IncidentManagement::PendingEscalations::AlertCheckWorker).to receive(:bulk_perform_async)
.with(array_including([escalation_2.id], [escalation_1.id])) .with(array_including([escalation_2.id], [escalation_1.id]))
subject subject
......
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