diff options
author | Stan Hu <stanhu@gmail.com> | 2017-10-19 08:41:55 +0200 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-10-24 14:06:23 +0300 |
commit | 324b3bbaca9eb74169c8606f6a7d3279393348ff (patch) | |
tree | 315c770d7c52253eddeb08ddee92ecf9c167bc0c /spec | |
parent | 82446a2bd009e7d7481c35a142063a3973be77ce (diff) | |
download | gitlab-ce-324b3bbaca9eb74169c8606f6a7d3279393348ff.tar.gz |
Memoize GitLab logger to reduce open file descriptors
We see that in gitlab-org/gitlab-ee#3664 that if we log a lot of
data in Sidekiq workers, the number of open file descriptors
reaches over 1000. To avoid this, we can memoize the logger per
thread via RequestStore.
Closes gitlab-org/gitlab-ee#3664
Diffstat (limited to 'spec')
-rw-r--r-- | spec/lib/gitlab/app_logger_spec.rb | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/spec/lib/gitlab/app_logger_spec.rb b/spec/lib/gitlab/app_logger_spec.rb new file mode 100644 index 00000000000..c86d30ce6df --- /dev/null +++ b/spec/lib/gitlab/app_logger_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe Gitlab::AppLogger, :request_store do + subject { described_class } + + it 'builds a logger once' do + expect(::Logger).to receive(:new).and_call_original + + subject.info('hello world') + subject.error('hello again') + end +end |