@@ -26,8 +26,17 @@ import { createCodeWhispererChatStreamingClient } from '../../shared/clients/cod
2626import { getClientId , getOptOutPreference , getOperatingSystem } from '../../shared/telemetry/util'
2727import { extensionVersion } from '../../shared/vscode/env'
2828
29+ // Re-enable once BE is able to handle retries.
30+ const writeAPIRetryOptions = {
31+ maxRetries : 0 ,
32+ retryDelayOptions : {
33+ // The default number of milliseconds to use in the exponential backoff
34+ base : 500 ,
35+ } ,
36+ }
37+
2938// Create a client for featureDev proxy client based off of aws sdk v2
30- export async function createFeatureDevProxyClient ( ) : Promise < FeatureDevProxyClient > {
39+ export async function createFeatureDevProxyClient ( options ?: Partial < ServiceOptions > ) : Promise < FeatureDevProxyClient > {
3140 const bearerToken = await AuthUtil . instance . getBearerToken ( )
3241 const cwsprConfig = getCodewhispererConfig ( )
3342 return ( await globals . sdkClientBuilder . createAwsService (
@@ -37,27 +46,22 @@ export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClie
3746 region : cwsprConfig . region ,
3847 endpoint : cwsprConfig . endpoint ,
3948 token : new Token ( { token : bearerToken } ) ,
40- // SETTING TO 0 FOR BETA. RE-ENABLE FOR RE-INVENT
41- maxRetries : 0 ,
42- retryDelayOptions : {
43- // The default number of milliseconds to use in the exponential backoff
44- base : 500 ,
45- } ,
49+ ...options ,
4650 } as ServiceOptions ,
4751 undefined
4852 ) ) as FeatureDevProxyClient
4953}
5054
5155export class FeatureDevClient {
52- public async getClient ( ) {
56+ public async getClient ( options ?: Partial < ServiceOptions > ) {
5357 // Should not be stored for the whole session.
5458 // Client has to be reinitialized for each request so we always have a fresh bearerToken
55- return await createFeatureDevProxyClient ( )
59+ return await createFeatureDevProxyClient ( options )
5660 }
5761
5862 public async createConversation ( ) {
5963 try {
60- const client = await this . getClient ( )
64+ const client = await this . getClient ( writeAPIRetryOptions )
6165 getLogger ( ) . debug ( `Executing createTaskAssistConversation with {}` )
6266 const { conversationId, $response } = await client . createTaskAssistConversation ( ) . promise ( )
6367 getLogger ( ) . debug ( `${ featureName } : Created conversation: %O` , {
@@ -82,7 +86,7 @@ export class FeatureDevClient {
8286
8387 public async createUploadUrl ( conversationId : string , contentChecksumSha256 : string , contentLength : number ) {
8488 try {
85- const client = await this . getClient ( )
89+ const client = await this . getClient ( writeAPIRetryOptions )
8690 const params = {
8791 uploadContext : {
8892 taskAssistPlanningUploadContext : {
@@ -119,7 +123,7 @@ export class FeatureDevClient {
119123
120124 public async startCodeGeneration ( conversationId : string , uploadId : string , message : string ) {
121125 try {
122- const client = await this . getClient ( )
126+ const client = await this . getClient ( writeAPIRetryOptions )
123127 const params = {
124128 conversationState : {
125129 conversationId,
0 commit comments