class Siberite::Client::Blocking

Constants

SLEEP_TIMES

random backoff sleeping

Public Instance Methods

get(*args) click to toggle source
# File lib/siberite/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) click to toggle source
# File lib/siberite/client/blocking.rb, line 22
def get_without_blocking(*args)
  client.get(*args)
end

Private Instance Methods

sleep_for_count(count) click to toggle source
# File lib/siberite/client/blocking.rb, line 28
def sleep_for_count(count)
  base = SLEEP_TIMES[count] || SLEEP_TIMES.last

  time = ((rand * base) + base) / 2
  sleep time if time > 0
end