Fix for remaining comments.
- Call function within try/catch - Syntax clean up
This commit is contained in:
parent
f0c9f6a09d
commit
fadd2854e5
1 changed files with 5 additions and 4 deletions
|
@ -27,14 +27,15 @@ time_conversion = {
|
||||||
def check_redis_alive(fn):
|
def check_redis_alive(fn):
|
||||||
def inner(*args, **kwargs):
|
def inner(*args, **kwargs):
|
||||||
try:
|
try:
|
||||||
redis_client.ping()
|
if fn.__name__ == 'main':
|
||||||
|
redis_client.ping()
|
||||||
|
return fn(*args, **kwargs)
|
||||||
except ConnectionError as e:
|
except ConnectionError as e:
|
||||||
print(e)
|
print('Failed to connect to redis! %s' % e.message)
|
||||||
if fn.__name__ == "main":
|
if fn.__name__ == 'main':
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
else:
|
else:
|
||||||
return abort(500)
|
return abort(500)
|
||||||
return fn(*args, **kwargs)
|
|
||||||
return inner
|
return inner
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue