Welcome to mirror list, hosted at ThFree Co, Russian Federation.

add_severity_system_note_worker.rb « incident_management « workers « app - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: b2d2d6748eee06f50ba25a1d75b3c0b881aa83a5 (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
29
30
# 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

    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

      incident.transaction do
        SystemNoteService.change_incident_severity(incident, user)
        TimelineEvents::CreateService.change_severity(incident, user)
      end
    end
  end
end