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
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']['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']['cron'] ||= '0 3 * * 0'
Settings.cron_jobs['import_software_licenses_worker']['job_class'] = 'ImportSoftwareLicensesWorker'
......
......@@ -180,10 +180,10 @@
- 2
- - incident_management_apply_incident_sla_exceeded_label
- 1
- - incident_management_escalations_pending_alert_escalation_check
- 1
- - incident_management_oncall_rotations_persist_shifts_job
- 1
- - incident_management_pending_escalations_alert_check
- 1
- - invalid_gpg_signature_update
- 2
- - irker
......
......@@ -52,7 +52,7 @@ module IncidentManagement
def process_escalations(escalation_ids)
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
......
......@@ -294,15 +294,6 @@
:weight: 1
:idempotent:
: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
:worker_name: IncidentManagement::IncidentSlaExceededCheckWorker
:feature_category: :incident_management
......@@ -323,6 +314,15 @@
:idempotent: true
:tags:
- :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
:worker_name: Iterations::Cadences::CreateIterationsWorker
:feature_category: :issue_tracking
......@@ -1053,15 +1053,6 @@
:idempotent: true
:tags:
- :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
:worker_name: IncidentManagement::OncallRotations::PersistShiftsJob
:feature_category: :incident_management
......@@ -1072,6 +1063,15 @@
:idempotent: true
:tags:
- :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
:worker_name: LdapGroupSyncWorker
:feature_category: :authentication_and_authorization
......
# frozen_string_literal: true
module IncidentManagement
module Escalations
class PendingAlertEscalationCheckWorker
module PendingEscalations
class AlertCheckWorker
include ApplicationWorker
urgency :high
......@@ -10,19 +10,11 @@ module IncidentManagement
idempotent!
feature_category :incident_management
def initialize(escalation_id)
@escalation_id = escalation_id
end
def perform
def perform(escalation_id)
escalation = IncidentManagement::PendingEscalations::Alert.find(escalation_id)
IncidentManagement::PendingEscalations::ProcessService.new(escalation).execute
end
private
attr_reader :escalation_id
end
end
end
# frozen_string_literal: true
module IncidentManagement
module Escalations
class ScheduleEscalationCheckCronWorker
module PendingEscalations
class ScheduleCheckCronWorker
include ApplicationWorker
# This worker does not perform work scoped to a context
include CronjobQueue # rubocop:disable Scalability/CronWorkerContext
......@@ -13,7 +13,7 @@ module IncidentManagement
def perform
::IncidentManagement::PendingEscalations::Alert.processable.each_batch do |relation|
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
......
......@@ -54,7 +54,7 @@ RSpec.describe IncidentManagement::PendingEscalations::CreateService do
end
it 'creates the escalations and queues the escalation process check' do
expect(IncidentManagement::Escalations::PendingAlertEscalationCheckWorker)
expect(IncidentManagement::PendingEscalations::AlertCheckWorker)
.to receive(:bulk_perform_async)
.with([[a_kind_of(Integer)], [a_kind_of(Integer)]])
......
......@@ -11,7 +11,7 @@ RSpec.shared_examples 'creates an escalation' do |count|
expected_args = []
count.times { expected_args << [a_kind_of(Integer)]}
expect(IncidentManagement::Escalations::PendingAlertEscalationCheckWorker)
expect(IncidentManagement::PendingEscalations::AlertCheckWorker)
.to receive(:bulk_perform_async)
.with(expected_args)
......
......@@ -2,13 +2,13 @@
require 'spec_helper'
RSpec.describe IncidentManagement::Escalations::PendingAlertEscalationCheckWorker do
let(:worker) { described_class.new(escalation.id) }
RSpec.describe IncidentManagement::PendingEscalations::AlertCheckWorker do
let(:worker) { described_class.new }
let_it_be(:escalation) { create(:incident_management_pending_alert_escalation) }
describe '#perform' do
subject { worker.perform }
subject { worker.perform(escalation.id) }
it 'processes the escalation' do
process_service = spy(IncidentManagement::PendingEscalations::ProcessService)
......
......@@ -2,7 +2,7 @@
require 'spec_helper'
RSpec.describe IncidentManagement::Escalations::ScheduleEscalationCheckCronWorker do
RSpec.describe IncidentManagement::PendingEscalations::ScheduleCheckCronWorker do
let(:worker) { described_class.new }
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
subject { worker.perform }
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]))
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