readis 0.2.2 → 0.2.3

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.
Files changed (2) hide show
  1. data/lib/readis.rb +9 -1
  2. metadata +1 -1
data/lib/readis.rb CHANGED
@@ -16,7 +16,6 @@ class Readis
16
16
  def method_missing(name, *args, &block)
17
17
  begin
18
18
  @client.send(name, *args, &block)
19
- @backoff = 1
20
19
  rescue => e
21
20
  puts "Command failed because of error: #{e.message}"
22
21
  puts "Sleeping #{@backoff} seconds"
@@ -24,10 +23,19 @@ class Readis
24
23
  if @backoff <= 8
25
24
  @backoff = @backoff * 2
26
25
  end
26
+ @backoff = 1 if alive?
27
27
  retry
28
28
  end
29
29
  end
30
30
 
31
+ def alive?
32
+ begin
33
+ @client.ping
34
+ rescue
35
+ false
36
+ end
37
+ end
38
+
31
39
  def type(*args)
32
40
  @client.send(:type, *args)
33
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: readis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: