summaryrefslogtreecommitdiff
path: root/lib/gitlab_projects.rb
diff options
context:
space:
mode:
authorRobert Speicher <robert@gitlab.com>2017-07-26 16:31:44 +0000
committerRobert Speicher <robert@gitlab.com>2017-07-26 16:31:44 +0000
commitcdea8630d0e0f2a726fcd0d377d815fe0bedd99f (patch)
tree2dabfd9f0de277d6db78de5243669c95e60dc8b5 /lib/gitlab_projects.rb
parent8c760edbf47c09389220af83b6c3bca649d5399d (diff)
parent18d7c1d934a343c99dc0d1adf0247ee2ce7b7606 (diff)
downloadgitlab-shell-cdea8630d0e0f2a726fcd0d377d815fe0bedd99f.tar.gz
Merge branch 'sh-defer-reference-counter-load' into 'master'
Optimize gitlab-projects by deferring the loading of gitlab_reference_counter See merge request !149
Diffstat (limited to 'lib/gitlab_projects.rb')
-rw-r--r--lib/gitlab_projects.rb8
1 files changed, 6 insertions, 2 deletions
diff --git a/lib/gitlab_projects.rb b/lib/gitlab_projects.rb
index 0b11ce3..4c63a40 100644
--- a/lib/gitlab_projects.rb
+++ b/lib/gitlab_projects.rb
@@ -5,7 +5,6 @@ require 'open3'
require_relative 'gitlab_config'
require_relative 'gitlab_logger'
require_relative 'gitlab_metrics'
-require_relative 'gitlab_reference_counter'
class GitlabProjects
GLOBAL_HOOKS_DIRECTORY = File.join(ROOT_PATH, 'hooks')
@@ -408,7 +407,12 @@ class GitlabProjects
end
def gitlab_reference_counter
- @gitlab_reference_counter ||= GitlabReferenceCounter.new(full_path)
+ @gitlab_reference_counter ||= begin
+ # Defer loading because this pulls in gitlab_net, which takes 100-200 ms
+ # to load
+ require_relative 'gitlab_reference_counter'
+ GitlabReferenceCounter.new(full_path)
+ end
end
def rsync(src, dest, rsync_path = 'rsync')