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
e3ff4e2c
Commit
e3ff4e2c
authored
Feb 03, 2020
by
rpereira2
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refactor ClusterUpdateAppWorker#execute method
Reduce the Cognitive complexity of ClusterUpdateAppWorker#execute.
parent
95296bae
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
4 deletions
+8
-4
ee/app/workers/cluster_update_app_worker.rb
ee/app/workers/cluster_update_app_worker.rb
+8
-4
No files found.
ee/app/workers/cluster_update_app_worker.rb
View file @
e3ff4e2c
...
...
@@ -28,14 +28,18 @@ class ClusterUpdateAppWorker
return
unless
project
find_application
(
app_name
,
app_id
)
do
|
app
|
break
if
app
.
updated_since?
(
scheduled_time
)
break
if
app
.
update_in_progress?
Clusters
::
Applications
::
PrometheusUpdateService
.
new
(
app
,
project
).
execute
update_prometheus
(
app
,
scheduled_time
,
project
)
end
end
# rubocop: enable CodeReuse/ActiveRecord
def
update_prometheus
(
app
,
scheduled_time
,
project
)
return
if
app
.
updated_since?
(
scheduled_time
)
return
if
app
.
update_in_progress?
Clusters
::
Applications
::
PrometheusUpdateService
.
new
(
app
,
project
).
execute
end
def
lease_key
@lease_key
||=
"
#{
self
.
class
.
name
.
underscore
}
-
#{
@app_id
}
"
end
...
...
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