Skip to content

Commit ee2ac96

Browse files
authored
fix(amazonq): increase GetTransformation maxRetries #6220
## Problem Customers that experience transient network issues are unable to view their transformation results when the `GetTransformation` API fails after the default of 3 retries. ## Solution Increase retries to 8.
1 parent a3fdfca commit ee2ac96

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

packages/core/src/codewhisperer/client/codewhisperer.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ export class DefaultCodeWhispererClient {
132132
)) as CodeWhispererClient
133133
}
134134

135-
async createUserSdkClient(): Promise<CodeWhispererUserClient> {
135+
async createUserSdkClient(maxRetries?: number): Promise<CodeWhispererUserClient> {
136136
const isOptedOut = CodeWhispererSettings.instance.isOptoutEnabled()
137137
session.setFetchCredentialStart()
138138
const bearerToken = await AuthUtil.instance.getBearerToken()
@@ -144,6 +144,7 @@ export class DefaultCodeWhispererClient {
144144
apiConfig: userApiConfig,
145145
region: cwsprConfig.region,
146146
endpoint: cwsprConfig.endpoint,
147+
maxRetries: maxRetries,
147148
credentials: new Credentials({ accessKeyId: 'xxx', secretAccessKey: 'xxx' }),
148149
onRequestSetup: [
149150
(req) => {
@@ -293,7 +294,8 @@ export class DefaultCodeWhispererClient {
293294
public async codeModernizerGetCodeTransformation(
294295
request: CodeWhispererUserClient.GetTransformationRequest
295296
): Promise<PromiseResult<CodeWhispererUserClient.GetTransformationResponse, AWSError>> {
296-
return (await this.createUserSdkClient()).getTransformation(request).promise()
297+
// instead of the default of 3 retries, use 8 retries for this API which is polled every 5 seconds
298+
return (await this.createUserSdkClient(8)).getTransformation(request).promise()
297299
}
298300

299301
/**

0 commit comments

Comments
 (0)