Skip to content

Commit

Permalink
Merge master into feature/sdkv3
Browse files Browse the repository at this point in the history
  • Loading branch information
aws-toolkit-automation authored Dec 17, 2024
2 parents 92e8c7f + ee2ac96 commit f649fbb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions packages/core/src/codewhisperer/client/codewhisperer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ export class DefaultCodeWhispererClient {
)) as CodeWhispererClient
}

async createUserSdkClient(): Promise<CodeWhispererUserClient> {
async createUserSdkClient(maxRetries?: number): Promise<CodeWhispererUserClient> {
const isOptedOut = CodeWhispererSettings.instance.isOptoutEnabled()
session.setFetchCredentialStart()
const bearerToken = await AuthUtil.instance.getBearerToken()
Expand All @@ -144,6 +144,7 @@ export class DefaultCodeWhispererClient {
apiConfig: userApiConfig,
region: cwsprConfig.region,
endpoint: cwsprConfig.endpoint,
maxRetries: maxRetries,
credentials: new Credentials({ accessKeyId: 'xxx', secretAccessKey: 'xxx' }),
onRequestSetup: [
(req) => {
Expand Down Expand Up @@ -293,7 +294,8 @@ export class DefaultCodeWhispererClient {
public async codeModernizerGetCodeTransformation(
request: CodeWhispererUserClient.GetTransformationRequest
): Promise<PromiseResult<CodeWhispererUserClient.GetTransformationResponse, AWSError>> {
return (await this.createUserSdkClient()).getTransformation(request).promise()
// instead of the default of 3 retries, use 8 retries for this API which is polled every 5 seconds
return (await this.createUserSdkClient(8)).getTransformation(request).promise()
}

/**
Expand Down

0 comments on commit f649fbb

Please sign in to comment.