@@ -26,8 +26,17 @@ import { createCodeWhispererChatStreamingClient } from '../../shared/clients/cod
26
26
import { getClientId , getOptOutPreference , getOperatingSystem } from '../../shared/telemetry/util'
27
27
import { extensionVersion } from '../../shared/vscode/env'
28
28
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
+
29
38
// 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 > {
31
40
const bearerToken = await AuthUtil . instance . getBearerToken ( )
32
41
const cwsprConfig = getCodewhispererConfig ( )
33
42
return ( await globals . sdkClientBuilder . createAwsService (
@@ -37,27 +46,22 @@ export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClie
37
46
region : cwsprConfig . region ,
38
47
endpoint : cwsprConfig . endpoint ,
39
48
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 ,
46
50
} as ServiceOptions ,
47
51
undefined
48
52
) ) as FeatureDevProxyClient
49
53
}
50
54
51
55
export class FeatureDevClient {
52
- public async getClient ( ) {
56
+ public async getClient ( options ?: Partial < ServiceOptions > ) {
53
57
// Should not be stored for the whole session.
54
58
// Client has to be reinitialized for each request so we always have a fresh bearerToken
55
- return await createFeatureDevProxyClient ( )
59
+ return await createFeatureDevProxyClient ( options )
56
60
}
57
61
58
62
public async createConversation ( ) {
59
63
try {
60
- const client = await this . getClient ( )
64
+ const client = await this . getClient ( writeAPIRetryOptions )
61
65
getLogger ( ) . debug ( `Executing createTaskAssistConversation with {}` )
62
66
const { conversationId, $response } = await client . createTaskAssistConversation ( ) . promise ( )
63
67
getLogger ( ) . debug ( `${ featureName } : Created conversation: %O` , {
@@ -82,7 +86,7 @@ export class FeatureDevClient {
82
86
83
87
public async createUploadUrl ( conversationId : string , contentChecksumSha256 : string , contentLength : number ) {
84
88
try {
85
- const client = await this . getClient ( )
89
+ const client = await this . getClient ( writeAPIRetryOptions )
86
90
const params = {
87
91
uploadContext : {
88
92
taskAssistPlanningUploadContext : {
@@ -119,7 +123,7 @@ export class FeatureDevClient {
119
123
120
124
public async startCodeGeneration ( conversationId : string , uploadId : string , message : string ) {
121
125
try {
122
- const client = await this . getClient ( )
126
+ const client = await this . getClient ( writeAPIRetryOptions )
123
127
const params = {
124
128
conversationState : {
125
129
conversationId,
0 commit comments