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 +4 -4
- data/lib/heartcheck/checks/redis.rb +12 -3
- data/lib/heartcheck/redis/version.rb +1 -1
- data/lib/heartcheck/redis.rb +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1a1b429ab4a669787b34fd48b09cd5cf12f2def3
|
4
|
+
data.tar.gz: fbd16e404e4d32fefd13cabb3360103c84ed5277
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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(
|
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(
|
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
|
data/lib/heartcheck/redis.rb
CHANGED
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.
|
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:
|
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.
|
185
|
+
rubygems_version: 2.6.13
|
186
186
|
signing_key:
|
187
187
|
specification_version: 4
|
188
188
|
summary: A redis checker.
|