コード例 #1
0
def test_can_create_default_retry_handler():
    mock_client = mock.Mock()
    mock_client.meta.service_model.service_id = model.ServiceId('my-service')
    assert_is_instance(standard.register_retry_handler(mock_client),
                       standard.RetryHandler)
    call_args_list = mock_client.meta.events.register.call_args_list
    # We should have registered the retry quota to after-calls
    first_call = call_args_list[0][0]
    second_call = call_args_list[1][0]
    # Not sure if there's a way to verify the class associated with the
    # bound method matches what we expect.
    assert_equal(first_call[0], 'after-call.my-service')
    assert_equal(second_call[0], 'needs-retry.my-service')
コード例 #2
0
 def _register_v2_standard_retries(self, client):
     max_attempts = client.meta.config.retries.get('total_max_attempts')
     kwargs = {'client': client}
     if max_attempts is not None:
         kwargs['max_attempts'] = max_attempts
     standard.register_retry_handler(**kwargs)