Skip to content

Commit ab7dae3

Browse files
authored
cancel session when token is cancelled (microsoft#236056)
microsoft/vscode-copilot-release#2433
1 parent 12b060f commit ab7dae3

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/vs/workbench/contrib/inlineChat/browser/inlineChatController.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import * as aria from '../../../../base/browser/ui/aria/aria.js';
7-
import { Barrier, DeferredPromise, Queue } from '../../../../base/common/async.js';
7+
import { Barrier, DeferredPromise, Queue, raceCancellation } from '../../../../base/common/async.js';
88
import { CancellationToken, CancellationTokenSource } from '../../../../base/common/cancellation.js';
99
import { toErrorMessage } from '../../../../base/common/errorMessage.js';
1010
import { onUnexpectedError } from '../../../../base/common/errors.js';
@@ -1187,7 +1187,9 @@ export class InlineChatController implements IEditorContribution {
11871187
this.cancelSession();
11881188
}
11891189

1190-
await run;
1190+
const dispo = token.onCancellationRequested(() => this.cancelSession());
1191+
await raceCancellation(run, token);
1192+
dispo.dispose();
11911193
return true;
11921194
}
11931195
}

0 commit comments

Comments
 (0)