Commit 68101b1d authored by Peter Leitzen's avatar Peter Leitzen

Merge branch 'refactor-cluster_update_app_worker' into 'master'

Refactor ClusterUpdateAppWorker#execute

See merge request gitlab-org/gitlab!24299
parents f23a07e3 e3ff4e2c
...@@ -28,14 +28,18 @@ class ClusterUpdateAppWorker ...@@ -28,14 +28,18 @@ class ClusterUpdateAppWorker
return unless project return unless project
find_application(app_name, app_id) do |app| find_application(app_name, app_id) do |app|
break if app.updated_since?(scheduled_time) update_prometheus(app, scheduled_time, project)
break if app.update_in_progress?
Clusters::Applications::PrometheusUpdateService.new(app, project).execute
end end
end end
# rubocop: enable CodeReuse/ActiveRecord # 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 def lease_key
@lease_key ||= "#{self.class.name.underscore}-#{@app_id}" @lease_key ||= "#{self.class.name.underscore}-#{@app_id}"
end 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