-
Notifications
You must be signed in to change notification settings - Fork 736
config(dev): re-enable Q dev API retry for read APIs #5706
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,17 @@ import { createCodeWhispererChatStreamingClient } from '../../shared/clients/cod | |
| import { getClientId, getOptOutPreference, getOperatingSystem } from '../../shared/telemetry/util' | ||
| import { extensionVersion } from '../../shared/vscode/env' | ||
|
|
||
| // Re-enable once BE is able to handle retries. | ||
| const writeAPIRetryOptions = { | ||
| maxRetries: 0, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is still at zero, so what effect does this PR have?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It ensure Read APIs using default 3 retries. We don't handle write retries at this moment, but we would support it in the future. |
||
| retryDelayOptions: { | ||
| // The default number of milliseconds to use in the exponential backoff | ||
| base: 500, | ||
| }, | ||
| } | ||
|
|
||
| // Create a client for featureDev proxy client based off of aws sdk v2 | ||
| export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClient> { | ||
| export async function createFeatureDevProxyClient(options?: Partial<ServiceOptions>): Promise<FeatureDevProxyClient> { | ||
| const bearerToken = await AuthUtil.instance.getBearerToken() | ||
| const cwsprConfig = getCodewhispererConfig() | ||
| return (await globals.sdkClientBuilder.createAwsService( | ||
|
|
@@ -37,27 +46,22 @@ export async function createFeatureDevProxyClient(): Promise<FeatureDevProxyClie | |
| region: cwsprConfig.region, | ||
| endpoint: cwsprConfig.endpoint, | ||
| token: new Token({ token: bearerToken }), | ||
| // SETTING TO 0 FOR BETA. RE-ENABLE FOR RE-INVENT | ||
| maxRetries: 0, | ||
| retryDelayOptions: { | ||
| // The default number of milliseconds to use in the exponential backoff | ||
| base: 500, | ||
| }, | ||
| ...options, | ||
| } as ServiceOptions, | ||
| undefined | ||
| )) as FeatureDevProxyClient | ||
| } | ||
|
|
||
| export class FeatureDevClient { | ||
| public async getClient() { | ||
| public async getClient(options?: Partial<ServiceOptions>) { | ||
| // Should not be stored for the whole session. | ||
| // Client has to be reinitialized for each request so we always have a fresh bearerToken | ||
| return await createFeatureDevProxyClient() | ||
| return await createFeatureDevProxyClient(options) | ||
| } | ||
|
|
||
| public async createConversation() { | ||
| try { | ||
| const client = await this.getClient() | ||
| const client = await this.getClient(writeAPIRetryOptions) | ||
| getLogger().debug(`Executing createTaskAssistConversation with {}`) | ||
| const { conversationId, $response } = await client.createTaskAssistConversation().promise() | ||
| getLogger().debug(`${featureName}: Created conversation: %O`, { | ||
|
|
@@ -82,7 +86,7 @@ export class FeatureDevClient { | |
|
|
||
| public async createUploadUrl(conversationId: string, contentChecksumSha256: string, contentLength: number) { | ||
| try { | ||
| const client = await this.getClient() | ||
| const client = await this.getClient(writeAPIRetryOptions) | ||
| const params = { | ||
| uploadContext: { | ||
| taskAssistPlanningUploadContext: { | ||
|
|
@@ -119,7 +123,7 @@ export class FeatureDevClient { | |
|
|
||
| public async startCodeGeneration(conversationId: string, uploadId: string, message: string) { | ||
| try { | ||
| const client = await this.getClient() | ||
| const client = await this.getClient(writeAPIRetryOptions) | ||
| const params = { | ||
| conversationState: { | ||
| conversationId, | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.