Skip to content

Instantly share code, notes, and snippets.

@shooley
Created January 23, 2014 00:55
Show Gist options
  • Save shooley/8570732 to your computer and use it in GitHub Desktop.
Save shooley/8570732 to your computer and use it in GitHub Desktop.
Redis Helper Module
module RedisHelper
def is_redis_open?
begin
Timeout::timeout(1) do
begin
s = TCPSocket.new(REDIS_CONFIG['server_url'], 6379)
s.close
return true
rescue Errno::ECONNREFUSED, Errno::EHOSTUNREACH
return false
end
end
rescue Timeout::Error
end
return false
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment