Skip to content

Commit 1fd35af

Browse files
committed
fix(amazonqFeatureDev): require isCancellation to localize in the instance and abort the individual call
1 parent 3cfaf44 commit 1fd35af

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

packages/core/src/amazonqFeatureDev/session/sessionState.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -158,14 +158,12 @@ abstract class CodeGenBase {
158158
codeGenerationId,
159159
telemetry: telemetry,
160160
workspaceFolders,
161-
isCancellationRequested,
162161
}: {
163162
messenger: Messenger
164163
fs: VirtualFileSystem
165164
codeGenerationId: string
166165
telemetry: TelemetryHelper
167166
workspaceFolders: CurrentWsFolders
168-
isCancellationRequested?: boolean
169167
}): Promise<{
170168
newFiles: NewFileInfo[]
171169
deletedFiles: DeletedFileInfo[]
@@ -175,7 +173,7 @@ abstract class CodeGenBase {
175173
}> {
176174
for (
177175
let pollingIteration = 0;
178-
pollingIteration < this.pollCount && !isCancellationRequested;
176+
pollingIteration < this.pollCount && !this.isCancellationRequested;
179177
++pollingIteration
180178
) {
181179
const codegenResult = await this.config.proxyClient.getCodeGeneration(this.conversationId, codeGenerationId)
@@ -260,7 +258,7 @@ abstract class CodeGenBase {
260258
}
261259
}
262260
}
263-
if (!isCancellationRequested) {
261+
if (!this.isCancellationRequested) {
264262
// still in progress
265263
const errorMessage = i18n('AWS.amazonq.featureDev.error.codeGen.timeout')
266264
throw new ToolkitError(errorMessage, { code: 'CodeGenTimeout' })
@@ -320,7 +318,7 @@ export class CodeGenState extends CodeGenBase implements SessionState {
320318
this.currentCodeGenerationId
321319
)
322320

323-
if (!action.tokenSource?.token.isCancellationRequested) {
321+
if (!this.isCancellationRequested) {
324322
action.messenger.sendAnswer({
325323
message: i18n('AWS.amazonq.featureDev.pillText.generatingCode'),
326324
type: 'answer-part',
@@ -338,7 +336,6 @@ export class CodeGenState extends CodeGenBase implements SessionState {
338336
codeGenerationId,
339337
telemetry: action.telemetry,
340338
workspaceFolders: this.config.workspaceFolders,
341-
isCancellationRequested: action.tokenSource?.token.isCancellationRequested,
342339
})
343340

344341
if (codeGeneration && !action.tokenSource?.token.isCancellationRequested) {

0 commit comments

Comments
 (0)