Skip to content

Commit 52cc07f

Browse files
authored
fix(amazonq): increase polling frequency for bearer token. (aws#7123)
## Problem During the bug bash, someone encountered the LSP attempting to use an expired bearer token. I am unable to reproduce the issue, but can speculate at the cause. We refresh the bearer token on the LSP every 1 minute, but if the token expires, and then a request is made before the next refresh it can fail. Note: this is a temporary solution until we have LSP auth. ## Solution - double the frequency with which we check the token. - We still only send the token if it changed, meaning this won't cause noisy request to LSP. --- - Treat all work as PUBLIC. Private `feature/x` branches will not be squash-merged at release time. - Your code changes must meet the guidelines in [CONTRIBUTING.md](https://github.com/aws/aws-toolkit-vscode/blob/master/CONTRIBUTING.md#guidelines). - License: I confirm that my contribution is made under the terms of the Apache 2.0 license.
1 parent 2055bbf commit 52cc07f

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

packages/amazonq/src/lsp/auth.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ export class AmazonQLspAuth {
8686
this.client.info(`UpdateBearerToken: ${JSON.stringify(request)}`)
8787
}
8888

89-
public startTokenRefreshInterval(pollingTime: number = oneMinute) {
89+
public startTokenRefreshInterval(pollingTime: number = oneMinute / 2) {
9090
const interval = setInterval(async () => {
9191
await this.refreshConnection().catch((e) => {
9292
getLogger('amazonqLsp').error('Unable to update bearer token: %s', (e as Error).message)

0 commit comments

Comments
 (0)