Avoid reattempting authentication for auth versions where it has no effect#188
Open
tobgu wants to merge 1 commit intoncw:masterfrom
Open
Avoid reattempting authentication for auth versions where it has no effect#188tobgu wants to merge 1 commit intoncw:masterfrom
tobgu wants to merge 1 commit intoncw:masterfrom
Conversation
ncw
reviewed
Jun 6, 2025
Owner
ncw
left a comment
There was a problem hiding this comment.
This is a nice idea - thanks for implementing it.
I'm not sure the logic is correct though - please see comments inline.
| } | ||
|
|
||
| retries := 1 | ||
| shouldReattempt := c.Auth.ShouldReattemptAuth() |
Author
There was a problem hiding this comment.
This doesn't ever seem to be used?
It's checked on line 523 and assigned false on line 524, no?
| // Try again for a limited number of times on | ||
| // AuthorizationFailed or BadRequest. This allows us | ||
| // to try some alternate forms of the request | ||
| if (err == AuthorizationFailed || err == BadRequest) && retries > 0 { |
Owner
There was a problem hiding this comment.
I think this still needs the retries logic otherwise it will retry forever won't it?
Author
There was a problem hiding this comment.
I think this still needs the retries logic otherwise it will retry forever won't it?
The inclusion of shouldReattempt in the if-condition and setting it to false if the condition evaluates to true should prevent infinite retries, no?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are circumstances where the automatic authentication retry causes confusion and unexpected behaviour.
For example when the password is entered by a human and mistyped. If the underlying authentication system causes the user to be blocked after X attempts this will happen sooner than expected (after X/2 attempts).
This PR limits the retry to only happen for versions where it may have any actual positive effect (v2).