Created
December 17, 2013 07:24
-
-
Save Freedom-Dark-Lord/8001308 to your computer and use it in GitHub Desktop.
retry connect when redis throw error
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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