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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/workers/incident_management')
-rw-r--r--app/workers/incident_management/process_alert_worker.rb29
1 files changed, 29 insertions, 0 deletions
diff --git a/app/workers/incident_management/process_alert_worker.rb b/app/workers/incident_management/process_alert_worker.rb
new file mode 100644
index 00000000000..f3d5bc5c66b
--- /dev/null
+++ b/app/workers/incident_management/process_alert_worker.rb
@@ -0,0 +1,29 @@
+# frozen_string_literal: true
+
+module IncidentManagement
+ class ProcessAlertWorker
+ include ApplicationWorker
+
+ queue_namespace :incident_management
+ feature_category :incident_management
+
+ def perform(project_id, alert)
+ project = find_project(project_id)
+ return unless project
+
+ create_issue(project, alert)
+ end
+
+ private
+
+ def find_project(project_id)
+ Project.find_by_id(project_id)
+ end
+
+ def create_issue(project, alert)
+ IncidentManagement::CreateIssueService
+ .new(project, alert)
+ .execute
+ end
+ end
+end