Skip to content

Commit 8edd045

Browse files
committed
Use Promise.allSettled in deactivate, and add this logic to web-extension
1 parent 6b4bc85 commit 8edd045

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/extension.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,10 @@ export function activate(context: vscode.ExtensionContext) {
2323

2424
export async function deactivate() {
2525
// Do our best to log out of all sessions
26+
27+
const promises: Promise<any>[] = [];
2628
for (const serverSession of serverSessions) {
27-
await logout(serverSession[1].serverName);
29+
promises.push(logout(serverSession[1].serverName));
2830
}
31+
await Promise.allSettled(promises);
2932
}

src/web-extension.ts

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,21 @@
33
import * as vscode from "vscode";
44
import { ServerManagerView } from "./ui/serverManagerView";
55
import { commonActivate } from "./commonActivate";
6+
import { logout, serverSessions } from "./makeRESTRequest";
67

78
export function activate(context: vscode.ExtensionContext) {
8-
const view = new ServerManagerView(context);
9+
const view = new ServerManagerView(context);
910

10-
// Common activation steps
11-
return commonActivate(context, view);
11+
// Common activation steps
12+
return commonActivate(context, view);
1213
}
1314

14-
export function deactivate() { }
15+
export async function deactivate() {
16+
// Do our best to log out of all sessions
17+
18+
const promises: Promise<any>[] = [];
19+
for (const serverSession of serverSessions) {
20+
promises.push(logout(serverSession[1].serverName));
21+
}
22+
await Promise.allSettled(promises);
23+
}

0 commit comments

Comments
 (0)