summaryrefslogtreecommitdiff
path: root/app/views/admin/dashboard/index.html.haml
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2018-05-15 23:06:55 -0700
committerStan Hu <stanhu@gmail.com>2018-05-16 08:27:48 -0700
commite38938b332ca751dfc5e784f242d620016e8ca43 (patch)
tree439a6672547ba9d50d995e7717df28ab6ded89fd /app/views/admin/dashboard/index.html.haml
parent0288e2525fbe2bc226726b5289fc6e5b3a949da2 (diff)
downloadgitlab-ce-e38938b332ca751dfc5e784f242d620016e8ca43.tar.gz
Fix Error 500 viewing admin page due to statement timeouts
Uses PostgreSQL tuple estimates to provide a much faster yet approximate count. See https://wiki.postgresql.org/wiki/Slow_Counting for more details. We only use this fast method if the table has been analyzed or vacuumed within the last hour. Closes #46255
Diffstat (limited to 'app/views/admin/dashboard/index.html.haml')
-rw-r--r--app/views/admin/dashboard/index.html.haml20
1 files changed, 10 insertions, 10 deletions
diff --git a/app/views/admin/dashboard/index.html.haml b/app/views/admin/dashboard/index.html.haml
index bbf0e0fb95c..41ef646fc0e 100644
--- a/app/views/admin/dashboard/index.html.haml
+++ b/app/views/admin/dashboard/index.html.haml
@@ -10,7 +10,7 @@
= link_to admin_projects_path do
%h3.text-center
Projects:
- = number_with_delimiter(Project.cached_count)
+ = approximate_count_with_delimiters(Project)
%hr
= link_to('New project', new_project_path, class: "btn btn-new")
.col-sm-4
@@ -19,7 +19,7 @@
= link_to admin_users_path do
%h3.text-center
Users:
- = number_with_delimiter(User.count)
+ = approximate_count_with_delimiters(User)
%hr
= link_to 'New user', new_admin_user_path, class: "btn btn-new"
.col-sm-4
@@ -28,7 +28,7 @@
= link_to admin_groups_path do
%h3.text-center
Groups:
- = number_with_delimiter(Group.count)
+ = approximate_count_with_delimiters(Group)
%hr
= link_to 'New group', new_admin_group_path, class: "btn btn-new"
.row
@@ -39,31 +39,31 @@
%p
Forks
%span.light.pull-right
- = number_with_delimiter(ForkedProjectLink.count)
+ = approximate_count_with_delimiters(ForkedProjectLink)
%p
Issues
%span.light.pull-right
- = number_with_delimiter(Issue.count)
+ = approximate_count_with_delimiters(Issue)
%p
Merge Requests
%span.light.pull-right
- = number_with_delimiter(MergeRequest.count)
+ = approximate_count_with_delimiters(MergeRequest)
%p
Notes
%span.light.pull-right
- = number_with_delimiter(Note.count)
+ = approximate_count_with_delimiters(Note)
%p
Snippets
%span.light.pull-right
- = number_with_delimiter(Snippet.count)
+ = approximate_count_with_delimiters(Snippet)
%p
SSH Keys
%span.light.pull-right
- = number_with_delimiter(Key.count)
+ = approximate_count_with_delimiters(Key)
%p
Milestones
%span.light.pull-right
- = number_with_delimiter(Milestone.count)
+ = approximate_count_with_delimiters(Milestone)
%p
Active Users
%span.light.pull-right