def await_redis()

in genesyscloud/genesyscloud-audiohook/dialogflow_api.py [0:0]


def await_redis(conversation_name: str) -> bool:
    """Check if the redis memory store connection has been established or not
    """
    conversation_name = determine_conversation_name_without_location(
        conversation_name)
    # give the user bit time to accept the call and wait for the Agent Assist Backend
    # to create the redis memory store
    counter = AWAIT_REDIS_COUNTER

    redis_exists = redis_client.exists(conversation_name) != 0
    while not redis_exists and counter > 0:
        time.sleep(AWAIT_REDIS_SECOND_PER_COUNTER)
        redis_exists = redis_client.exists(conversation_name) != 0
        counter = counter - 1
    logging.debug("return to send resume message redis client exist %s and final counter %s ",
                  redis_exists, counter)
    return redis_exists