-
Notifications
You must be signed in to change notification settings - Fork 11
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
fix: Add retry logic in "_waitForPkamAuthSuccess" to retry when secondary is temporarily not reachable #684
fix: Add retry logic in "_waitForPkamAuthSuccess" to retry when secondary is temporarily not reachable #684
Conversation
…dary is temporarily not reachable
try { | ||
pkamAuthSucceeded = | ||
await _attemptPkamAuth(atLookUp, enrollmentIdFromServer); | ||
} catch (e) { |
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.
Does _attemptPkamAuth
throw an exception if PKAM auth fails in a "normal" way (i.e. the enrollment has not yet been approved)?
Some code comments explaining what exactly is going on here would be useful
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.
In the _attemptPkamAuth
method, if enrollment is denied, it returns an AtEnrollmentException
. This exception is caught in the catch block of _waitForPkamAuthSuccess
(which calls _attemptPkamAuth
),
triggering the retry logic that we want to avoid. To prevent this, we need to handle AtEnrollmentException
separately here, which introduces code duplication.
To handle all the exceptions in one place, moved the existing exception handing logic in _attemptPkamAuth here. With the changes, _attemptPkamAuth do not handle exception. It rethrows and all the exceptions are handled in the _waitForPkamAuthSuccess.
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.
OK - I'd suggest we now remove _attemptPkamAuth and move its code inline, as _attemptPkamAuth isn't used anywhere else
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.
Removed the "_attemptPkamAuth" and moved its code inline.
try { | ||
pkamAuthSucceeded = | ||
await _attemptPkamAuth(atLookUp, enrollmentIdFromServer); | ||
} catch (e) { |
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.
OK - I'd suggest we now remove _attemptPkamAuth and move its code inline, as _attemptPkamAuth isn't used anywhere else
…aitForPkamAuthSuccess
- What I did
- How I did it
_attemptPkamAuth
method, if enrollment is denied, it returns anAtEnrollmentException
. This exception is caught in the catch block of_waitForPkamAuthSuccess
(which calls_attemptPkamAuth
), triggering the retry logic that we want to avoid. To prevent this, we need to handleAtEnrollmentException
separately here, which introduces code duplication.- How to verify it
- Description for the changelog