Commit b5bbca81 authored by Peter Leitzen's avatar Peter Leitzen

Refactor sending alert emails

parent c95a3cfb
......@@ -8,8 +8,7 @@ module Projects
return false unless valid_version?
return false unless valid_alert_manager_token?(token)
notification_service.async.prometheus_alerts_fired(project, firings) if firings.any?
send_alert_email(project, firings) if firings.any?
persist_events(project, current_user, params)
true
......@@ -83,6 +82,12 @@ module Projects
ActiveSupport::SecurityUtils.variable_size_secure_compare(expected, actual)
end
def send_alert_email(projects, firing_alerts)
notification_service
.async
.prometheus_alerts_fired(project, firings)
end
def persist_events(project, current_user, params)
CreateEventsService.new(project, current_user, params).execute
end
......
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