summaryrefslogtreecommitdiff
path: root/app/workers/incident_management/add_severity_system_note_worker.rb
blob: 31da7b0bcfef3bc038de9999765a12bec02054a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true

module IncidentManagement
  class AddSeveritySystemNoteWorker # rubocop:disable Scalability/IdempotentWorker
    include ApplicationWorker

    data_consistency :always
    worker_resource_boundary :cpu

    sidekiq_options retry: 3

    queue_namespace :incident_management
    feature_category :incident_management
    tags :exclude_from_kubernetes

    def perform(incident_id, user_id)
      return if incident_id.blank? || user_id.blank?

      incident = Issue.with_issue_type(:incident).find_by_id(incident_id)
      return unless incident

      user = User.find_by_id(user_id)
      return unless user

      SystemNoteService.change_incident_severity(incident, user)
    end
  end
end