Skip to content

Commit 25b6473

Browse files
committed
short term mitigation for listAvailableProfiles throttling error
1 parent 70ba83f commit 25b6473

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

packages/core/src/codewhisperer/commands/basicCommands.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -608,6 +608,7 @@ const registerToolkitApiCallbackOnce = once(() => {
608608
const auth = Auth.instance
609609

610610
auth.onDidChangeConnectionState(async (e) => {
611+
console.log(e)
611612
if (_toolkitApi && 'declareConnection' in _toolkitApi) {
612613
const id = e.id
613614
const conn = await auth.getConnection({ id })

packages/core/src/codewhisperer/region/regionProfileManager.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ import { parse } from '@aws-sdk/util-arn-parser'
2828
import { isAwsError, ToolkitError } from '../../shared/errors'
2929
import { telemetry } from '../../shared/telemetry/telemetry'
3030
import { localize } from '../../shared/utilities/vsCodeUtils'
31+
import { sleep } from '../../shared/utilities/timeoutUtils'
32+
import { randomInt } from 'crypto'
3133

3234
// TODO: is there a better way to manage all endpoint strings in one place?
3335
export const defaultServiceConfig: CodeWhispererConfig = {
@@ -116,6 +118,7 @@ export class RegionProfileManager {
116118
return []
117119
}
118120
const availableProfiles: RegionProfile[] = []
121+
await sleep(randomInt(1000, 3000))
119122
for (const [region, endpoint] of endpoints.entries()) {
120123
const client = await this._createQClient(region, endpoint, conn as SsoConnection)
121124
const requester = async (request: CodeWhispererUserClient.ListAvailableProfilesRequest) =>

0 commit comments

Comments
 (0)