diff options
author | rpereira2 <rpereira@gitlab.com> | 2019-04-04 13:44:08 +0300 |
---|---|---|
committer | Peter Leitzen <pleitzen@gitlab.com> | 2019-04-04 23:22:46 +0300 |
commit | 5dd6e752c0c3d572c645ac56a79c6c5a3fbd5157 (patch) | |
tree | 3f6d3542c57125751ed9cc21aa2aa354b0da816a /app | |
parent | 833206abf833b0c43e35d97b3f2fea98d91d5572 (diff) |
Some code improvements
- Use strong_memoize for prometheus_adapter since it can be nil in some
cases.
- Do not phrase spec descriptions with 'should'.
Diffstat (limited to 'app')
-rw-r--r-- | app/services/prometheus/proxy_service.rb | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/app/services/prometheus/proxy_service.rb b/app/services/prometheus/proxy_service.rb index cadfe59b900..c5d2b84878b 100644 --- a/app/services/prometheus/proxy_service.rb +++ b/app/services/prometheus/proxy_service.rb @@ -3,6 +3,7 @@ module Prometheus class ProxyService < BaseService include ReactiveCaching + include Gitlab::Utils::StrongMemoize self.reactive_cache_key = ->(service) { service.cache_key } self.reactive_cache_lease_timeout = 30.seconds @@ -91,7 +92,9 @@ module Prometheus end def prometheus_adapter - @prometheus_adapter ||= @proxyable.prometheus_adapter + strong_memoize(:prometheus_adapter) do + @proxyable.prometheus_adapter + end end def prometheus_client_wrapper |