Skip to content

Instantly share code, notes, and snippets.

@superfeedr
Created February 21, 2010 12:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save superfeedr/310288 to your computer and use it in GitHub Desktop.
Save superfeedr/310288 to your computer and use it in GitHub Desktop.
##
# We slightly modify The redis library so that it doesn't fail when the server is not there
# if this happens, filtering will not go through for this specific feed. But will work for other feeds
# using othe redis caches, which is good.
# Our app then just gas to rescue ProtocolError and act upon that.
module EventMachine
module Protocols
module Redis
def call_command(argv, &blk)
raise ProtocolError if error?()
callback { raw_call_command(argv, &blk) }
end
def unbind
puts "*** unbinding" if $debug
if @connected or @reconnecting
EM.add_timer(1) do
reconnect @host, @port
auth @current_password if @current_password
select @current_database if @current_database
end
@connected = false
@reconnecting = true
@deferred_status = nil
else
# raise 'Unable to connect to redis server'
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment