Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
3e645d84
Commit
3e645d84
authored
Apr 28, 2021
by
Vitali Tatarintev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mark ProcessAlertWorkerV2 as idempotent
parent
f4c1c223
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
11 additions
and
1 deletion
+11
-1
app/workers/all_queues.yml
app/workers/all_queues.yml
+1
-1
app/workers/incident_management/process_alert_worker_v2.rb
app/workers/incident_management/process_alert_worker_v2.rb
+2
-0
spec/workers/incident_management/process_alert_worker_v2_spec.rb
...rkers/incident_management/process_alert_worker_v2_spec.rb
+8
-0
No files found.
app/workers/all_queues.yml
View file @
3e645d84
...
...
@@ -1054,7 +1054,7 @@
:urgency: :low
:resource_boundary: :unknown
:weight:
2
:idempotent:
:idempotent:
true
:tags: []
-
:name: incident_management:incident_management_process_prometheus_alert
:worker_name: IncidentManagement::ProcessPrometheusAlertWorker
...
...
app/workers/incident_management/process_alert_worker_v2.rb
View file @
3e645d84
...
...
@@ -7,6 +7,8 @@ module IncidentManagement
queue_namespace
:incident_management
feature_category
:incident_management
idempotent!
def
perform
(
alert_id
)
return
unless
alert_id
...
...
spec/workers/incident_management/process_alert_worker_v2_spec.rb
View file @
3e645d84
...
...
@@ -42,6 +42,14 @@ RSpec.describe IncidentManagement::ProcessAlertWorkerV2 do
expect
(
Gitlab
::
AppLogger
).
not_to
have_received
(
:warn
)
end
it_behaves_like
'an idempotent worker'
do
let
(
:job_args
)
{
[
alert
.
id
]
}
it
'does not create a second issue'
do
expect
{
perform_worker
}.
to
change
{
Issue
.
count
}.
by
(
1
)
end
end
end
context
'with valid alert'
do
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment