def db_func_with_retry(db_func, *args, **kwargs):
    """
    This method is a generic retry function to support database setup and cleanup.
    """
    # Using as an annotation would be nice but annotations are evaluated at import
    # time and simple ways to use the annotation means the config gets read before
    # it is setup. Likely there is a way to use some proxies to delay the actual
    # reading of config values however this is lesser code.
    retrying_obj = retrying.Retrying(
        retry_on_exception=_retry_if_connection_error,
        wait_exponential_multiplier=cfg.CONF.database.connection_retry_backoff_mul
        * 1000,
        wait_exponential_max=cfg.CONF.database.connection_retry_backoff_max_s * 1000,
        stop_max_delay=cfg.CONF.database.connection_retry_max_delay_m * 60 * 1000,
    )
    return retrying_obj.call(db_func, *args, **kwargs)

    This method is a generic retry function to support database setup and cleanup.
    
st2common/st2common/persistence/db_init.py