Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,9 @@ macro_rules! impl_inner_call {
return res;
},
Err(e) => {
let failed_attempts = errors.len() + 1;
errors.push(e);
let e = errors[errors.len() - 1];
let failed_attempts = errors.len();

if retries_exhausted(failed_attempts, $self.config.retry()) {
warn!("call '{}' failed after {} attempts", stringify!($name), failed_attempts);
Expand All @@ -62,8 +64,6 @@ macro_rules! impl_inner_call {

warn!("call '{}' failed with {}, retry: {}/{}", stringify!($name), e, failed_attempts, $self.config.retry());

errors.push(e);

// Only one thread will try to recreate the client getting the write lock,
// other eventual threads will get Err and will block at the beginning of
// previous loop when trying to read()
Expand All @@ -77,16 +77,16 @@ macro_rules! impl_inner_call {
break;
},
Err(e) => {
let failed_attempts = errors.len() + 1;
errors.push(e);
let e = errors[errors.len() - 1];
let failed_attempts = errors.len();

if retries_exhausted(failed_attempts, $self.config.retry()) {
warn!("re-creating client failed after {} attempts", failed_attempts);
return Err(Error::AllAttemptsErrored(errors));
}

warn!("re-creating client failed with {}, retry: {}/{}", e, failed_attempts, $self.config.retry());

errors.push(e);
}
}
}
Expand Down