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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db828c2104d540e27fda8d4896b3ea91620c6b40034ef7be09678938bd57eba3
4
- data.tar.gz: 4dad188a4afe02239af267042e3fea818c7544889dcfa17962a83f7fa00735c9
3
+ metadata.gz: 40bd21a33a97cc9cdb4574144a800b5462a06a5ee84a2e4a4ec490e1f0a586e4
4
+ data.tar.gz: c6041deccfe452abfdaad7e17f5f6213b3e7351df0f1993fda5feceb0788b116
5
5
  SHA512:
6
- metadata.gz: 30e5029889fc90ff67fd12cc9e2be6eedf438474130d03ba41474998415747230f57a7e0aea424afd5c32274c3d2b89fa1b0eb61a4f2a5ee640e17cb5b30853c
7
- data.tar.gz: 010cbdfd28fe74a99a9d4ed7ce3ea1062f14726fd9a92239a7c8f389c7a393bcebdea5d26af83fa289d6bac7a4391506c21ec85c732d0e3ffbcd805d8e163ea7
6
+ metadata.gz: 9fe6a0efc6673dca98e2f1760ae0b5a592782379384a1548bed762c83955c9d752caa7fea47545c6a771ecf9fd00e53446d46a112347b87f4e3536549f4dd37a
7
+ data.tar.gz: 8a7d3447ae0aa78938086c1aab6002445c519c3d395ea71fa821c818be123056f5cb5ffa2648fb4d43da079a09ee46d2a3859f8a7a9d4487dabb33ca44c324e2
@@ -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
- values = conn.mget(keys)
9
- Hash[keys.zip(values)]
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
- values = conn.mget(keys)
14
- Hash[keys.zip(values)]
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
- ttls = conn.eval(%{
29
- local matcher = KEYS[1] .. ":*"
30
- local ttls = {}
31
-
32
- local cursor = "0"
33
- repeat
34
- local result = redis.call("SCAN", cursor, "MATCH", matcher)
35
- cursor = result[1]
36
-
37
- local keys = result[2]
38
- for i, key in ipairs(keys) do
39
- ttls[#ttls + 1] = redis.call('ttl', key)
40
- end
41
- until cursor == "0"
42
- return ttls
43
- }, :keys => ['locks'])
44
- Hash[keys.zip(ttls)]
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.6"
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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: periodically
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - wyozi