Skip to content

Commit

Permalink
remove no_retries from exponential strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
waahm7 committed Nov 11, 2024
1 parent 98f445b commit 67d6c68
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 47 deletions.
2 changes: 0 additions & 2 deletions include/aws/io/retry_strategy.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ struct aws_exponential_backoff_retry_options {
uint32_t backoff_scale_factor_ms;
/* Max retry backoff in seconds. Default is 20 seconds */
uint32_t max_backoff_secs;
/* Disables retries completely. Attempts to acquire_token will fail with `AWS_IO_RETRY_PERMISSION_DENIED` */
bool no_retries;
/** Jitter mode to use, see comments for aws_exponential_backoff_jitter_mode.
* Default is AWS_EXPONENTIAL_BACKOFF_JITTER_DEFAULT */
enum aws_exponential_backoff_jitter_mode jitter_mode;
Expand Down
4 changes: 0 additions & 4 deletions source/exponential_backoff_retry_strategy.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ struct exponential_backoff_retry_token {
size_t max_retries;
uint64_t backoff_scale_factor_ns;
uint64_t maximum_backoff_ns;
bool no_retries;
enum aws_exponential_backoff_jitter_mode jitter_mode;
/* Let's not make this worse by constantly moving across threads if we can help it */
struct aws_event_loop *bound_loop;
Expand Down Expand Up @@ -117,9 +116,6 @@ static int s_exponential_retry_acquire_token(
/* no resource contention here so no timeouts. */
(void)timeout_ms;
struct exponential_backoff_strategy *exponential_backoff_strategy = retry_strategy->impl;
if (exponential_backoff_strategy->config.no_retries) {
return aws_raise_error(AWS_IO_RETRY_PERMISSION_DENIED);
}

struct exponential_backoff_retry_token *backoff_retry_token =
aws_mem_calloc(retry_strategy->allocator, 1, sizeof(struct exponential_backoff_retry_token));
Expand Down
41 changes: 0 additions & 41 deletions tests/exponential_backoff_retry_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,44 +328,3 @@ static int s_test_exponential_backoff_retry_invalid_options_fn(struct aws_alloca
}
AWS_TEST_CASE(test_exponential_backoff_retry_invalid_options, s_test_exponential_backoff_retry_invalid_options_fn)

static int s_test_exponential_backoff_no_retries_fn(struct aws_allocator *allocator, void *ctx) {
(void)ctx;

aws_io_library_init(allocator);

struct aws_event_loop_group *el_group = aws_event_loop_group_new_default(allocator, 1, NULL);
struct aws_exponential_backoff_retry_options config = {
.max_retries = 3,
.no_retries = true,
.el_group = el_group,
};

struct aws_retry_strategy *retry_strategy = aws_retry_strategy_new_exponential_backoff(allocator, &config);
ASSERT_NOT_NULL(retry_strategy);

struct exponential_backoff_test_data test_data = {
.retry_count = 0,
.failure_error_code = 0,
.mutex = AWS_MUTEX_INIT,
.cvar = AWS_CONDITION_VARIABLE_INIT,
};

ASSERT_SUCCESS(aws_mutex_lock(&test_data.mutex));
ASSERT_ERROR(
AWS_IO_RETRY_PERMISSION_DENIED,
aws_retry_strategy_acquire_retry_token(
retry_strategy, NULL, s_too_many_retries_test_token_acquired, &test_data, 0));

aws_mutex_unlock(&test_data.mutex);

ASSERT_UINT_EQUALS(0, test_data.retry_count);

aws_retry_strategy_release(retry_strategy);
aws_event_loop_group_release(el_group);

aws_io_library_clean_up();

return AWS_OP_SUCCESS;
}

AWS_TEST_CASE(test_exponential_backoff_no_retries, s_test_exponential_backoff_no_retries_fn)

0 comments on commit 67d6c68

Please sign in to comment.