Module: RedisProxy

Extended by:
RedisProxy
Included in:
RedisProxy
Defined in:
lib/airbrake_proxy/redis_proxy.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/airbrake_proxy/redis_proxy.rb', line 6

def method_missing method, *args
  tries = 0
  begin
    redis.send method, *args
  rescue Redis::TimeoutError, Redis::CannotConnectError
    if (tries += 1) < 10
      logger.warn '[RedisProxy] Retry a Redis call'
      retry
    else
      logger.warn '[RedisProxy] Fail a Redis call after 10 tries'
      raise
    end
  end
end