lib/resque/pool/lifeguard.rb in resque-pool-lifeguard-0.2.0 vs lib/resque/pool/lifeguard.rb in resque-pool-lifeguard-0.2.1
- old
+ new
@@ -2,10 +2,11 @@
require "resque/pool/lifeguard/version"
module Resque
class Pool
class Lifeguard
+ include Logging
def initialize hostname: Socket.gethostname, defaults: -> (env) { {} }
@defaults = defaults
@hostname = hostname
end
@@ -27,11 +28,11 @@
def self.reset!
Resque.redis.del pool_key
end
def call env
- values || set_defaults(env)
+ @values = values || set_defaults(env)
end
def reset!
Resque.redis.hdel pool_key, hostname
end
@@ -39,9 +40,12 @@
def values
Resque.decode Resque.redis.hget pool_key, hostname
rescue Resque::Helpers::DecodeException
reset!
nil
+ rescue Redis::TimeoutError, Redis::CannotConnectError
+ log "Could not get config from redis"
+ @values
end
def values= values
Resque.redis.hset pool_key, hostname, (Resque.encode values)
end