summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorSean McGivern <sean@mcgivern.me.uk>2018-06-19 11:40:52 +0000
committerSean McGivern <sean@mcgivern.me.uk>2018-06-19 11:40:52 +0000
commitd6c57146c5a8f122bd7313cbea1a236d45977650 (patch)
tree2fb94d776bd91837bcb362b94d64eef6c12d31c7 /app
parent57a2ac1869de943f86aa3465caa37e8f1ced0099 (diff)
parent4f9068dfc06269ca7e2247fb0be2796452546de1 (diff)
downloadgitlab-ce-d6c57146c5a8f122bd7313cbea1a236d45977650.tar.gz
Merge branch 'sh-optimize-locks-check-ce' into 'master'
Eliminate N+1 queries in LFS file lock checks during a push See merge request gitlab-org/gitlab-ce!19978
Diffstat (limited to 'app')
-rw-r--r--app/models/project.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index e5fa1c4db7b..0d777515536 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -25,6 +25,7 @@ class Project < ActiveRecord::Base
include FastDestroyAll::Helpers
include WithUploads
include BatchDestroyDependentAssociations
+ extend Gitlab::Cache::RequestCache
extend Gitlab::ConfigHelper
@@ -2013,6 +2014,11 @@ class Project < ActiveRecord::Base
@gitlab_deploy_token ||= deploy_tokens.gitlab_deploy_token
end
+ def any_lfs_file_locks?
+ lfs_file_locks.any?
+ end
+ request_cache(:any_lfs_file_locks?) { self.id }
+
private
def storage