diff options
author | Stan Hu <stanhu@gmail.com> | 2017-10-19 09:41:55 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-10-24 14:06:23 +0300 |
commit | 324b3bbaca9eb74169c8606f6a7d3279393348ff (patch) | |
tree | 315c770d7c52253eddeb08ddee92ecf9c167bc0c /spec/lib/gitlab/app_logger_spec.rb | |
parent | 82446a2bd009e7d7481c35a142063a3973be77ce (diff) |
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/lib/gitlab/app_logger_spec.rb')
-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 |