summaryrefslogtreecommitdiff
path: root/app/controllers/sessions_controller.rb
diff options
context:
space:
mode:
authorJacob Vosmaer (GitLab) <jacob@gitlab.com>2016-06-15 15:12:56 +0000
committerJacob Vosmaer (GitLab) <jacob@gitlab.com>2016-06-15 15:12:56 +0000
commit2f459a03e00deb21bd774cb91dc0749b2e7c8905 (patch)
tree73a0b697a7c7512c786d328dc8be7d4bba364577 /app/controllers/sessions_controller.rb
parenta8b46301907abeeedab4010a966bbd8efc8d370c (diff)
parent3b21174d32695d10124bd4d582db14947bf4162d (diff)
downloadgitlab-ce-2f459a03e00deb21bd774cb91dc0749b2e7c8905.tar.gz
Merge branch '18225-avoid-full-table-users-count' into 'master'
Check if the Users table has exactly one user limiting the whole set ## What does this MR do? Limit the query set so about a full scan for all the rows on the users table (only scan to records) #18225 See merge request !4492
Diffstat (limited to 'app/controllers/sessions_controller.rb')
-rw-r--r--app/controllers/sessions_controller.rb2
1 files changed, 1 insertions, 1 deletions
diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb
index dae8f7b1447..17aed816cbd 100644
--- a/app/controllers/sessions_controller.rb
+++ b/app/controllers/sessions_controller.rb
@@ -40,7 +40,7 @@ class SessionsController < Devise::SessionsController
# Handle an "initial setup" state, where there's only one user, it's an admin,
# and they require a password change.
def check_initial_setup
- return unless User.count == 1
+ return unless User.limit(2).count == 1 # Count as much 2 to know if we have exactly one
user = User.admins.last