Skip to content

Instantly share code, notes, and snippets.

@wanghuida
Created December 17, 2013 07:24
Show Gist options
  • Save wanghuida/8001308 to your computer and use it in GitHub Desktop.
Save wanghuida/8001308 to your computer and use it in GitHub Desktop.
retry connect when redis throw error
pool = redis.ConnectionPool(host='localhost', port=6379, db=0);
redisHandle = redis.StrictRedis(connection_pool=pool);
def retry():
try:
print redisHandle.ping();
except Exception,e:
print e
time.sleep(3);
retry();
retry();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment