コード例 #1
0
def _failover_read_request(request_fn, endpoint, path, body, params, timeout):
    """ This function auto-retries read-only requests until they return a 2xx status code. """
    try:
        return request_fn("GET", endpoint, path, body, params, timeout)
    except (requests.exceptions.RequestException,
            Non200ResponseException) as ex:
        raise FailoverException(ex)
コード例 #2
0
ファイル: test_failover.py プロジェクト: sabre1041/quay-1
def my_failover_func(i, should_raise=None):
    """
    Increments a counter and raises an exception when told.
    """
    i.increment()
    if should_raise is not None:
        raise should_raise()
    raise FailoverException(FinishedException())