diff options
author | Stan Hu <stanhu@gmail.com> | 2018-06-19 02:38:34 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2018-06-19 02:42:20 +0300 |
commit | 4f9068dfc06269ca7e2247fb0be2796452546de1 (patch) | |
tree | b8a4f61fb70187d1085d7ad0dacf08babf5c3b86 /lib/gitlab/checks | |
parent | 02c007bda52ac4cbcc8df98e2faf9273745bf951 (diff) |
Eliminate N+1 queries in LFS file locks checks during a push
This significantly improves performance when a user pushes many references.
project.path_locks.any? doesn't cache the output and runs `SELECT 1 AS one
FROM "path_locks" WHERE project_id = N` each time. When there are thousands
of refs being pushed, this can time out the unicorn worker.
CE port for https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/6159.
Diffstat (limited to 'lib/gitlab/checks')
-rw-r--r-- | lib/gitlab/checks/commit_check.rb | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/gitlab/checks/commit_check.rb b/lib/gitlab/checks/commit_check.rb index 43a52b493bb..22310e313ac 100644 --- a/lib/gitlab/checks/commit_check.rb +++ b/lib/gitlab/checks/commit_check.rb @@ -37,7 +37,7 @@ module Gitlab def validate_lfs_file_locks? strong_memoize(:validate_lfs_file_locks) do - project.lfs_enabled? && project.lfs_file_locks.any? && newrev && oldrev + project.lfs_enabled? && newrev && oldrev && project.any_lfs_file_locks? end end |