Skip to content

Commit b2cd214

Browse files
committed
Use cancellation token
1 parent e90d1e4 commit b2cd214

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

src/plugins/setup.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,16 @@ export default createPlugin(
192192

193193
commands.executeCommand("localstack.openLicensePage");
194194

195-
await activateLicenseUntilValid(outputChannel);
195+
await activateLicenseUntilValid(
196+
outputChannel,
197+
cancellationToken,
198+
);
199+
}
200+
201+
if (cancellationToken.isCancellationRequested) {
202+
return;
196203
}
204+
197205
//TODO add telemetry
198206

199207
/////////////////////////////////////////////////////////////////////

src/utils/license.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { LogOutputChannel } from "vscode";
1+
import type { CancellationToken, LogOutputChannel } from "vscode";
22

33
import { execLocalStack } from "./cli.ts";
44

@@ -29,8 +29,12 @@ export async function activateLicense(outputChannel: LogOutputChannel) {
2929

3030
export async function activateLicenseUntilValid(
3131
outputChannel: LogOutputChannel,
32+
cancellationToken: CancellationToken,
3233
): Promise<void> {
3334
while (true) {
35+
if (cancellationToken.isCancellationRequested) {
36+
break;
37+
}
3438
const licenseIsValid = await checkIsLicenseValid(outputChannel);
3539
if (licenseIsValid) {
3640
break;

0 commit comments

Comments
 (0)