gitlab-labkit 1.16.0 → 1.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 076bc93169bb2f40201938632e87cfb1ddf8fbd3cdb74f895970939da47632e3
4
- data.tar.gz: 4596ceee64a5754c7adfaeaeb571a19c9f778962423ff13a2339390d8a5ede96
3
+ metadata.gz: 7177b8f9210f24958a14c92f17ad35cc8d4ad7732e04a9407569e865ef2bf364
4
+ data.tar.gz: 688c6dd7b7c1a8c1062a1e17c534fa833f86053aff8945ab4d296c2223784711
5
5
  SHA512:
6
- metadata.gz: 3bd441afdb0a7d0f2bb9faa946a9edac112f97e8779fc98ff417289add5180b661a16a26d84b5dafca50032c0f9e0b96ef9099d864cb9a51210ca763bcb15c27
7
- data.tar.gz: 4b14cf9420fd83533383578e6771e553209c4e64be247d6d3333717be7e5e041381a12fb6cd8cb772cd1405822cb3b3018c410b3a01d9ae25c89137936758984
6
+ metadata.gz: 2b54fe16d5c1cfe12c704a4e84cdea8dece8155dcaa04132c9e52442bec03e6338f6a4bcb065aa87931aa2fedcbd2ecb5ecec390b00d110267ee54e95a5c694c
7
+ data.tar.gz: 8abc6a48c3f1b138a84f8502e5c4300bec5f05f98b0c8defb4280d12b1d424f70cf64e0afe3cc344ce61ceae145e9aaf11f252d9611da1e5c6a1f25aa37fe867
@@ -92,10 +92,12 @@ module Labkit
92
92
  end
93
93
 
94
94
  def incr_with_ttl(redis_key, period)
95
- count = @redis.incr(redis_key)
96
- # Set expiry only on first write to avoid resetting TTL on each call
97
- @redis.expire(redis_key, period) if count == 1
98
- count
95
+ @redis.with do |conn|
96
+ count = conn.incr(redis_key)
97
+ # Set expiry only on first write to avoid resetting TTL on each call
98
+ conn.expire(redis_key, period) if count == 1
99
+ count
100
+ end
99
101
  end
100
102
 
101
103
  def log_error(error, identifier)
@@ -6,7 +6,7 @@ module Labkit
6
6
  #
7
7
  # @example Configuration (e.g. in a Rails initializer)
8
8
  # Labkit::RateLimit.configure do |c|
9
- # c.redis = Redis.current
9
+ # c.redis = ConnectionPool.new { Redis.new } # must respond to .with { |conn| }
10
10
  # c.logger = Labkit::Logging::JsonLogger.new($stdout)
11
11
  # end
12
12
  #
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gitlab-labkit
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.16.0
4
+ version: 1.17.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Newdigate