heartcheck-redis 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 707377ca2d1e03e0fe21af1cffa03ab0265d7e4e
4
- data.tar.gz: 61d4b7aba405f3c04682b6795e8b5af98be57246
3
+ metadata.gz: 1a1b429ab4a669787b34fd48b09cd5cf12f2def3
4
+ data.tar.gz: fbd16e404e4d32fefd13cabb3360103c84ed5277
5
5
  SHA512:
6
- metadata.gz: a50e739b57aea618abf9248486e584f79dae5957c62e498850b1e417ec5913b42e4717ff831979222345edd676f16f636bf725327d23ab959d6b5a8465552590
7
- data.tar.gz: f8f14746910da0a891a78f11cd821e08de373034b0dc053ed2b19be7a5ad381bb95e05e06813e62232ca4a44246f7455dcc628897bda128b35947b569fe30251
6
+ metadata.gz: cb66c58ed72212528304b85683bb6f619f61677674ed3f8721283e1f8131e07ca277d5c051a76a00d83273a1f3d7c5b836c981d199100621e226e5ce40bfdaf3
7
+ data.tar.gz: '04814e9a1dc510c0f6473a4b61f16932430b887c02e4db937f41e7a8bb3f7b18cdef64b3ea9ee52453732c53565d2f6a2aadf759e05737838a8776e135caa7a5'
@@ -24,7 +24,7 @@ module Heartcheck
24
24
  #
25
25
  # @return [Bollean]
26
26
  def set?(con)
27
- con.set('check_test', 'heartcheck') == 'OK'
27
+ con.set(unique_check_key, 'heartcheck') == 'OK'
28
28
  end
29
29
 
30
30
  # test if can read on redis
@@ -33,7 +33,7 @@ module Heartcheck
33
33
  #
34
34
  # @return [Bollean]
35
35
  def get?(con)
36
- con.get('check_test') == 'heartcheck'
36
+ con.get(unique_check_key) == 'heartcheck'
37
37
  end
38
38
 
39
39
  # test if can delete on redis
@@ -42,7 +42,7 @@ module Heartcheck
42
42
  #
43
43
  # @return [Bollean]
44
44
  def del?(con)
45
- con.del('check_test') == 1
45
+ con.del(unique_check_key) == 1
46
46
  end
47
47
 
48
48
  # customize the error message
@@ -55,6 +55,15 @@ module Heartcheck
55
55
  def custom_error(name, key_error)
56
56
  @errors << "#{name} fails to #{key_error}"
57
57
  end
58
+
59
+ # generate an unique redis key
60
+ # It's necessary to run concurrent application instances/checks using a
61
+ # shared redis
62
+ #
63
+ # @return [String]
64
+ def unique_check_key
65
+ @unique_check_key ||= SecureRandom.hex
66
+ end
58
67
  end
59
68
  end
60
69
  end
@@ -2,6 +2,6 @@
2
2
  module Heartcheck
3
3
  # gem version
4
4
  module Redis
5
- VERSION = '1.0.3'
5
+ VERSION = '1.0.4'
6
6
  end
7
7
  end
@@ -1,3 +1,4 @@
1
1
  require 'redis'
2
+ require 'securerandom'
2
3
  require 'heartcheck'
3
4
  require 'heartcheck/checks/redis'
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: heartcheck-redis
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Locaweb
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-13 00:00:00.000000000 Z
11
+ date: 2018-01-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-telnet
@@ -182,7 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
182
182
  version: '0'
183
183
  requirements: []
184
184
  rubyforge_project:
185
- rubygems_version: 2.6.14
185
+ rubygems_version: 2.6.13
186
186
  signing_key:
187
187
  specification_version: 4
188
188
  summary: A redis checker.