Class: Kestrel::Client::Blocking

Inherits:
Proxy
  • Object
show all
Defined in:
lib/kestrel/client/blocking.rb

Constant Summary collapse

SLEEP_TIMES =

random backoff sleeping

[[0] * 1, [0.01] * 2, [0.1] * 2, [0.5] * 2, [1.0] * 1].flatten

Instance Attribute Summary

Attributes inherited from Proxy

#client

Instance Method Summary collapse

Methods inherited from Proxy

#initialize, #method_missing

Constructor Details

This class inherits a constructor from Kestrel::Client::Proxy

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Kestrel::Client::Proxy

Instance Method Details

#get(*args) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/kestrel/client/blocking.rb', line 9

def get(*args)
  count = 0

  while count += 1

    if response = client.get(*args)
      return response
    end

    sleep_for_count(count)
  end
end

#get_without_blocking(*args) ⇒ Object



22
23
24
# File 'lib/kestrel/client/blocking.rb', line 22

def get_without_blocking(*args)
  client.get(*args)
end