Commit cdea8630 authored by Robert Speicher's avatar Robert Speicher

Merge branch 'sh-defer-reference-counter-load' into 'master'

Optimize gitlab-projects by deferring the loading of gitlab_reference_counter

See merge request !149
parents 8c760edb 18d7c1d9
...@@ -5,7 +5,6 @@ require 'open3' ...@@ -5,7 +5,6 @@ require 'open3'
require_relative 'gitlab_config' require_relative 'gitlab_config'
require_relative 'gitlab_logger' require_relative 'gitlab_logger'
require_relative 'gitlab_metrics' require_relative 'gitlab_metrics'
require_relative 'gitlab_reference_counter'
class GitlabProjects class GitlabProjects
GLOBAL_HOOKS_DIRECTORY = File.join(ROOT_PATH, 'hooks') GLOBAL_HOOKS_DIRECTORY = File.join(ROOT_PATH, 'hooks')
...@@ -408,7 +407,12 @@ class GitlabProjects ...@@ -408,7 +407,12 @@ class GitlabProjects
end end
def gitlab_reference_counter 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 end
def rsync(src, dest, rsync_path = 'rsync') def rsync(src, dest, rsync_path = 'rsync')
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment