diff options
author | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-19 15:04:37 +0100 |
---|---|---|
committer | Pawel Chojnacki <pawel@chojnacki.ws> | 2018-01-29 15:13:04 +0100 |
commit | 27359dbf22efe1d8cde2039b4e8d0c9199ffbf43 (patch) | |
tree | a56503cae5b4818e66d2ec32dc321736b809169b /lib/gitlab/metrics | |
parent | 83ae17214552e74960654bf9073aad1d3ade9193 (diff) | |
download | gitlab-ce-27359dbf22efe1d8cde2039b4e8d0c9199ffbf43.tar.gz |
use class variable for Mutex instead of Const
Diffstat (limited to 'lib/gitlab/metrics')
-rw-r--r-- | lib/gitlab/metrics/concern.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/gitlab/metrics/concern.rb b/lib/gitlab/metrics/concern.rb index 304a352ec53..8b62535d5a5 100644 --- a/lib/gitlab/metrics/concern.rb +++ b/lib/gitlab/metrics/concern.rb @@ -1,8 +1,13 @@ +# rubocop:disable Style/ClassVars + module Gitlab module Metrics module Concern extend ActiveSupport::Concern - MUTEX = Mutex.new + + included do + @@_metric_provider_mutex = Mutex.new + end class_methods do def reload_metric!(name) @@ -37,7 +42,7 @@ module Gitlab end def synchronized_cache_fill(key) - MUTEX.synchronize do + @@_metric_provider_mutex.synchronize do @_metrics_provider_cache ||= {} @_metrics_provider_cache[key] ||= yield end |