Commit 7f7c573a authored by Doug Stull's avatar Doug Stull

Remove large instance limit on license breakdown

- no longer needed as we resolved that issue using
  background workers and caching the count.
parent 72f5919a
...@@ -2,7 +2,6 @@ ...@@ -2,7 +2,6 @@
class Admin::DashboardController < Admin::ApplicationController class Admin::DashboardController < Admin::ApplicationController
include CountHelper include CountHelper
helper_method :show_license_breakdown?
COUNTED_ITEMS = [Project, User, Group].freeze COUNTED_ITEMS = [Project, User, Group].freeze
...@@ -23,10 +22,6 @@ class Admin::DashboardController < Admin::ApplicationController ...@@ -23,10 +22,6 @@ class Admin::DashboardController < Admin::ApplicationController
def stats def stats
@users_statistics = UsersStatistics.latest @users_statistics = UsersStatistics.latest
end end
def show_license_breakdown?
false
end
end end
Admin::DashboardController.prepend_if_ee('EE::Admin::DashboardController') Admin::DashboardController.prepend_if_ee('EE::Admin::DashboardController')
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
dismissible: true.to_s } } dismissible: true.to_s } }
= notice[:message].html_safe = notice[:message].html_safe
- if @license.present? && show_license_breakdown? - if @license.present?
.license-panel.gl-mt-5 .license-panel.gl-mt-5
= render_if_exists 'admin/licenses/summary' = render_if_exists 'admin/licenses/summary'
= render_if_exists 'admin/licenses/breakdown' = render_if_exists 'admin/licenses/breakdown'
......
...@@ -7,24 +7,12 @@ module EE ...@@ -7,24 +7,12 @@ module EE
extend ActiveSupport::Concern extend ActiveSupport::Concern
extend ::Gitlab::Utils::Override extend ::Gitlab::Utils::Override
LICENSE_BREAKDOWN_USER_LIMIT = 100_000
override :index override :index
def index def index
super super
@license = License.current @license = License.current
end end
# The license section may time out if the number of users is
# high. To avoid 500 errors, just hide this section. This is a
# workaround for https://gitlab.com/gitlab-org/gitlab/issues/32287.
override :show_license_breakdown?
def show_license_breakdown?
return false unless @counts.is_a?(Hash)
@counts.fetch(::User, 0) < LICENSE_BREAKDOWN_USER_LIMIT
end
end end
end end
end end
---
title: Remove show license timeout guard on ee
merge_request: 47832
author:
type: performance
...@@ -4,8 +4,6 @@ require 'spec_helper' ...@@ -4,8 +4,6 @@ require 'spec_helper'
RSpec.describe Admin::DashboardController do RSpec.describe Admin::DashboardController do
describe '#index' do describe '#index' do
render_views
it "allows an admin user to access the page" do it "allows an admin user to access the page" do
sign_in(create(:user, :admin)) sign_in(create(:user, :admin))
...@@ -29,31 +27,5 @@ RSpec.describe Admin::DashboardController do ...@@ -29,31 +27,5 @@ RSpec.describe Admin::DashboardController do
expect(response).to have_gitlab_http_status(:not_found) expect(response).to have_gitlab_http_status(:not_found)
end end
it 'shows the license breakdown' do
sign_in(create(:user, :admin))
get :index
expect(response.body).to include('Users in License')
end
context 'when the user count is high' do
let(:counts) do
described_class::COUNTED_ITEMS.each_with_object({}) { |model, hash| hash[model] = described_class::LICENSE_BREAKDOWN_USER_LIMIT + 1 }
end
before do
expect(Gitlab::Database::Count).to receive(:approximate_counts).and_return(counts)
sign_in(create(:admin))
end
it 'hides the license breakdown' do
get :index
expect(response.body).not_to include('Users in License')
end
end
end end
end end
...@@ -17,7 +17,6 @@ RSpec.describe 'admin/dashboard/index.html.haml' do ...@@ -17,7 +17,6 @@ RSpec.describe 'admin/dashboard/index.html.haml' do
allow(view).to receive(:admin?).and_return(true) allow(view).to receive(:admin?).and_return(true)
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
allow(view).to receive(:show_license_breakdown?).and_return(true)
end end
context 'when license is present' do context 'when license is present' do
......
...@@ -17,7 +17,6 @@ RSpec.describe 'admin/dashboard/index.html.haml' do ...@@ -17,7 +17,6 @@ RSpec.describe 'admin/dashboard/index.html.haml' do
allow(view).to receive(:admin?).and_return(true) allow(view).to receive(:admin?).and_return(true)
allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings) allow(view).to receive(:current_application_settings).and_return(Gitlab::CurrentSettings.current_application_settings)
allow(view).to receive(:show_license_breakdown?).and_return(false)
end end
it "shows version of GitLab Workhorse" do it "shows version of GitLab Workhorse" do
......
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