periodically 0.0.6 → 0.0.7
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 +4 -4
- data/lib/periodically/debug.rb +33 -21
- data/periodically.gemspec +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 40bd21a33a97cc9cdb4574144a800b5462a06a5ee84a2e4a4ec490e1f0a586e4
|
4
|
+
data.tar.gz: c6041deccfe452abfdaad7e17f5f6213b3e7351df0f1993fda5feceb0788b116
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9fe6a0efc6673dca98e2f1760ae0b5a592782379384a1548bed762c83955c9d752caa7fea47545c6a771ecf9fd00e53446d46a112347b87f4e3536549f4dd37a
|
7
|
+
data.tar.gz: 8a7d3447ae0aa78938086c1aab6002445c519c3d395ea71fa821c818be123056f5cb5ffa2648fb4d43da079a09ee46d2a3859f8a7a9d4487dabb33ca44c324e2
|
data/lib/periodically/debug.rb
CHANGED
@@ -5,13 +5,21 @@ module Periodically
|
|
5
5
|
def self.total_debug_dump
|
6
6
|
error_counts = Periodically.redis do |conn|
|
7
7
|
keys = conn.scan_each(:match => "errors:*").to_a
|
8
|
-
|
9
|
-
|
8
|
+
if keys.length == 0
|
9
|
+
{}
|
10
|
+
else
|
11
|
+
values = conn.mget(keys)
|
12
|
+
Hash[keys.zip(values)]
|
13
|
+
end
|
10
14
|
end
|
11
15
|
error_messages = Periodically.redis do |conn|
|
12
16
|
keys = conn.scan_each(:match => "errormessages:*").to_a
|
13
|
-
|
14
|
-
|
17
|
+
if keys.length == 0
|
18
|
+
{}
|
19
|
+
else
|
20
|
+
values = conn.mget(keys)
|
21
|
+
Hash[keys.zip(values)]
|
22
|
+
end
|
15
23
|
end
|
16
24
|
locks = lock_ttls
|
17
25
|
{
|
@@ -25,23 +33,27 @@ module Periodically
|
|
25
33
|
def self.lock_ttls
|
26
34
|
Periodically.redis do |conn|
|
27
35
|
keys = conn.scan_each(:match => "locks:*").to_a
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
cursor =
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
36
|
+
if keys.length == 0
|
37
|
+
{}
|
38
|
+
else
|
39
|
+
ttls = conn.eval(%{
|
40
|
+
local matcher = KEYS[1] .. ":*"
|
41
|
+
local ttls = {}
|
42
|
+
|
43
|
+
local cursor = "0"
|
44
|
+
repeat
|
45
|
+
local result = redis.call("SCAN", cursor, "MATCH", matcher)
|
46
|
+
cursor = result[1]
|
47
|
+
|
48
|
+
local keys = result[2]
|
49
|
+
for i, key in ipairs(keys) do
|
50
|
+
ttls[#ttls + 1] = redis.call('ttl', key)
|
51
|
+
end
|
52
|
+
until cursor == "0"
|
53
|
+
return ttls
|
54
|
+
}, :keys => ['locks'])
|
55
|
+
Hash[keys.zip(ttls)]
|
56
|
+
end
|
45
57
|
end
|
46
58
|
end
|
47
59
|
end
|
data/periodically.gemspec
CHANGED
@@ -4,7 +4,7 @@ Gem::Specification.new do |gem|
|
|
4
4
|
|
5
5
|
gem.files = `git ls-files | grep -Ev '^(test|myapp|examples)'`.split("\n")
|
6
6
|
gem.name = "periodically"
|
7
|
-
gem.version = "0.0.
|
7
|
+
gem.version = "0.0.7"
|
8
8
|
gem.required_ruby_version = ">= 2.5.0"
|
9
9
|
|
10
10
|
gem.add_dependency "redis", ">= 4.1.0"
|