Class: Readis::Retry
- Inherits:
-
Object
show all
- Defined in:
- lib/readis.rb
Instance Method Summary
collapse
Constructor Details
#initialize(client) ⇒ Retry
Returns a new instance of Retry.
11
12
13
14
|
# File 'lib/readis.rb', line 11
def initialize(client)
@client = client
@backoff = 1
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &block) ⇒ Object
16
17
18
19
20
21
22
23
|
# File 'lib/readis.rb', line 16
def method_missing(name, *args, &block)
begin
@client.send(name, *args, &block)
rescue => e
sleep 0.5
retry
end
end
|
Instance Method Details
#alive? ⇒ Boolean
25
26
27
28
29
30
31
|
# File 'lib/readis.rb', line 25
def alive?
begin
@client.ping
rescue
false
end
end
|
#type(*args) ⇒ Object
33
34
35
|
# File 'lib/readis.rb', line 33
def type(*args)
@client.send(:type, *args)
end
|