mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
fix(core): disable retries for code assist streaming requests (#20561)
This commit is contained in:
@@ -84,6 +84,7 @@ describe('CodeAssistServer', () => {
|
||||
body: expect.any(String),
|
||||
signal: undefined,
|
||||
retryConfig: {
|
||||
retryDelay: 1000,
|
||||
retry: 3,
|
||||
noResponseRetries: 3,
|
||||
statusCodesToRetry: [
|
||||
@@ -410,15 +411,7 @@ describe('CodeAssistServer', () => {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
signal: undefined,
|
||||
retryConfig: {
|
||||
retry: 3,
|
||||
noResponseRetries: 3,
|
||||
statusCodesToRetry: [
|
||||
[429, 429],
|
||||
[499, 499],
|
||||
[500, 599],
|
||||
],
|
||||
},
|
||||
retry: false,
|
||||
});
|
||||
|
||||
expect(results).toHaveLength(2);
|
||||
|
||||
@@ -62,6 +62,7 @@ export interface HttpOptions {
|
||||
|
||||
export const CODE_ASSIST_ENDPOINT = 'https://cloudcode-pa.googleapis.com';
|
||||
export const CODE_ASSIST_API_VERSION = 'v1internal';
|
||||
const GENERATE_CONTENT_RETRY_DELAY_IN_MILLISECONDS = 1000;
|
||||
|
||||
export class CodeAssistServer implements ContentGenerator {
|
||||
constructor(
|
||||
@@ -141,6 +142,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
this.sessionId,
|
||||
),
|
||||
req.config?.abortSignal,
|
||||
GENERATE_CONTENT_RETRY_DELAY_IN_MILLISECONDS,
|
||||
);
|
||||
const duration = formatProtoJsonDuration(Date.now() - start);
|
||||
const streamingLatency: StreamingLatency = {
|
||||
@@ -294,6 +296,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
method: string,
|
||||
req: object,
|
||||
signal?: AbortSignal,
|
||||
retryDelay: number = 100,
|
||||
): Promise<T> {
|
||||
const res = await this.client.request<T>({
|
||||
url: this.getMethodUrl(method),
|
||||
@@ -306,6 +309,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
body: JSON.stringify(req),
|
||||
signal,
|
||||
retryConfig: {
|
||||
retryDelay,
|
||||
retry: 3,
|
||||
noResponseRetries: 3,
|
||||
statusCodesToRetry: [
|
||||
@@ -361,15 +365,7 @@ export class CodeAssistServer implements ContentGenerator {
|
||||
responseType: 'stream',
|
||||
body: JSON.stringify(req),
|
||||
signal,
|
||||
retryConfig: {
|
||||
retry: 3,
|
||||
noResponseRetries: 3,
|
||||
statusCodesToRetry: [
|
||||
[429, 429],
|
||||
[499, 499],
|
||||
[500, 599],
|
||||
],
|
||||
},
|
||||
retry: false,
|
||||
});
|
||||
|
||||
return (async function* (): AsyncGenerator<T> {
|
||||
|
||||
Reference in New Issue
Block a user