def check_redis_alive(fn):

    def inner(*args, **kwargs):
        try:
            if (fn.__name__ == 'main'):
                redis_client.ping()
            return fn(*args, **kwargs)
        except ConnectionError as e:
            print(('Failed to connect to redis! %s' % e.message))
            if (fn.__name__ == 'main'):
                sys.exit(0)
            else:
                return abort(500)
    return inner
def check_redis_alive(fn):

    def inner(*args, **kwargs):
        try:
            if (fn.__name__ == 'main'):
                redis_client.ping()
            return fn(*args, **kwargs)
        except ConnectionError as e:
            print(('Failed to connect to redis! %s' % e.message))
            if (fn.__name__ == 'main'):
                sys.exit(0)
            else:
                return abort(500)
    return inner