-
-
Notifications
You must be signed in to change notification settings - Fork 277
fix: refresh access token on policy retry #8149
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: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -198,11 +198,11 @@ export class ProfileMetricsService { | |
| * @returns The response from the API. | ||
| */ | ||
| async submitMetrics(data: ProfileMetricsSubmitMetricsRequest): Promise<void> { | ||
| const authToken = await this.#messenger.call( | ||
| 'AuthenticationController:getBearerToken', | ||
| data.entropySourceId ?? undefined, | ||
| ); | ||
| await this.#policy.execute(async () => { | ||
| const authToken = await this.#messenger.call( | ||
| 'AuthenticationController:getBearerToken', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. question (non-blocking): Is there a risk of getBearerToken itself triggering retries or delays inside the policy? getBearerToken can itself perform a full login flow (nonce fetch, snap signing, OIDC exchange) if the session is expired. Now that this call is inside policy.execute, any latency or transient failure from the auth flow will count against the retry policy's timeout/backoff budget. If getBearerToken throws (e.g. network error during auth), the policy will retry the entire callback including auth. This is likely fine (and probably desirable), but worth confirming this is intentional. |
||
| data.entropySourceId ?? undefined, | ||
| ); | ||
|
Comment on lines
+202
to
+205
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. issue (blocking): No test validates that the token is refreshed on retry |
||
| const url = new URL(`${this.#baseURL}/profile/accounts`); | ||
| const localResponse = await this.#fetch(url, { | ||
| method: 'PUT', | ||
|
|
||
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.
suggestion (non-blocking): Changelog entry wording could be clearer
The changelog could be misread as a new behavior on every first call. It's specifically about retries within the service policy only.