Commit e3ff4e2c authored by rpereira2's avatar rpereira2

Refactor ClusterUpdateAppWorker#execute method

Reduce the Cognitive complexity of ClusterUpdateAppWorker#execute.
parent 95296bae
......@@ -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
......
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