diff options
-rw-r--r-- | app/models/deployment.rb | 7 | ||||
-rw-r--r-- | changelogs/unreleased/63475-fix-n-1.yml | 5 | ||||
-rw-r--r-- | spec/models/deployment_spec.rb | 12 |
3 files changed, 6 insertions, 18 deletions
diff --git a/app/models/deployment.rb b/app/models/deployment.rb index a8f5642f726..3b31e7b1333 100644 --- a/app/models/deployment.rb +++ b/app/models/deployment.rb @@ -206,13 +206,8 @@ class Deployment < ApplicationRecord end end - # TODO remove fallback case to deployment_platform_cluster. - # Otherwise we will continue to pay the performance penalty described in - # https://gitlab.com/gitlab-org/gitlab-ce/issues/63475 def cluster_prometheus - cluster_with_fallback = cluster || deployment_platform_cluster - - cluster_with_fallback.application_prometheus if cluster_with_fallback&.application_prometheus_available? + cluster.application_prometheus if cluster&.application_prometheus_available? end def ref_path diff --git a/changelogs/unreleased/63475-fix-n-1.yml b/changelogs/unreleased/63475-fix-n-1.yml new file mode 100644 index 00000000000..3ed825290fd --- /dev/null +++ b/changelogs/unreleased/63475-fix-n-1.yml @@ -0,0 +1,5 @@ +--- +title: Improve performance of MergeRequestsController#ci_environment_status endpoint +merge_request: 30224 +author: +type: performance diff --git a/spec/models/deployment_spec.rb b/spec/models/deployment_spec.rb index 713fb647708..a926e1913a7 100644 --- a/spec/models/deployment_spec.rb +++ b/spec/models/deployment_spec.rb @@ -341,18 +341,6 @@ describe Deployment do it { is_expected.to be_truthy } end - - context 'fallback deployment platform' do - let(:cluster) { create(:cluster, :provided_by_user, environment_scope: '*', projects: [deployment.project]) } - let!(:prometheus) { create(:clusters_applications_prometheus, :installed, cluster: cluster) } - - before do - expect(deployment.project).to receive(:deployment_platform).and_return(cluster.platform) - expect(cluster.application_prometheus).to receive(:can_query?).and_return(true) - end - - it { is_expected.to be_truthy } - end end end |