-
Notifications
You must be signed in to change notification settings - Fork 71
Include latest error in AllAttemptsErrored #188
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
ValuedMammal
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Concept ACK, however you still have unwrap in your code which isn't great. Maybe it will be better to log the warning first before placing the error into the errors vec.
9d4d4aa to
59c28bd
Compare
|
Updated, how's about now?
|
|
In 59c28bd: I understand that we can expect Please also include a PR description that others can make sense of, and consider using conventional commits. Thanks for your contribution. @nabijaczleweli |
|
Sure, whatever; applied. You're free to rephrase the PR and commit descriptions as you see fit, from my POV "Include latest error in AllAttemptsErrored" follows all the relevant conventions and is human-readable. |
|
I had an additional comment related to the order of the logging statements. I think I would prefer this way, so that in the case of a failed attempt the latest error --- a/src/client.rs
+++ b/src/client.rs
@@ -55,16 +55,15 @@ macro_rules! impl_inner_call {
Err(e) => {
let failed_attempts = errors.len() + 1;
+ warn!("call '{}' failed with {}, retry: {}/{}", stringify!($name), e, failed_attempts, $self.config.retry());
+
+ errors.push(e);
+
if retries_exhausted(failed_attempts, $self.config.retry()) {
warn!("call '{}' failed after {} attempts", stringify!($name), failed_attempts);
- errors.push(e);
return Err(Error::AllAttemptsErrored(errors));
}
- 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()
@@ -80,15 +79,14 @@ macro_rules! impl_inner_call {
Err(e) => {
let failed_attempts = errors.len() + 1;
+ warn!("re-creating client failed with {}, retry: {}/{}", e, failed_attempts, $self.config.retry());
+
+ errors.push(e);
+
if retries_exhausted(failed_attempts, $self.config.retry()) {
warn!("re-creating client failed after {} attempts", failed_attempts);
- errors.push(e);
return Err(Error::AllAttemptsErrored(errors));
}
-
- warn!("re-creating client failed with {}, retry: {}/{}", e, failed_attempts, $self.config.retry());
-
- errors.push(e);
}
}
} |
|
I think this is a functional change (which I naturally wouldn't do unless otherwise directed), but I do prefer this order. Applied. |
oleonardolima
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cACK b97d900
It looks like a straight-forward fix, I'm only thinking about ways to reproduce the original issue and assert it's fixed.
Also, before merging it we should update the commit message (e.g fix: include latest error in `AllAttemptsErrored` ) and remove the the grep output from it's description IMHO.
b97d900 to
9ad8195
Compare
|
Message applied; idk what you mean with cACK |
cACK := Concept ACK |
9ad8195 to
29dec59
Compare
|
Updated to (a) lift the retry driver to a function (and the larger error handling code to a non-generic function which should have a positive (downward) effect on .text size) and (b) use this driver to test the fixed behaviour. |
Test fails at this point
29dec59 to
283d0cb
Compare
fixed here
already correctly collected
consumers
Closes #186