summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorStan Hu <stanhu@gmail.com>2017-10-19 08:41:55 +0200
committerStan Hu <stanhu@gmail.com>2017-10-24 14:06:23 +0300
commit324b3bbaca9eb74169c8606f6a7d3279393348ff (patch)
tree315c770d7c52253eddeb08ddee92ecf9c167bc0c /spec
parent82446a2bd009e7d7481c35a142063a3973be77ce (diff)
downloadgitlab-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.rb12
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