Skip to content

Commit

Permalink
Less time for teardown (#186)
Browse files Browse the repository at this point in the history
  • Loading branch information
lramos15 authored Sep 13, 2023
1 parent 80cfe95 commit e17e9ed
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions src/browser/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,11 @@ const webAppInsightsClientFactory = async (key: string, replacementOptions?: Rep
appInsightsClient?.flush(false);
},
dispose: async () => {
appInsightsClient?.flush(true);
const unloadPromise = new Promise<void>((resolve) => {
appInsightsClient?.unload(true, () => {
resolve();
appInsightsClient = undefined;
});
}, 1000);
}
);
return unloadPromise;
Expand Down
5 changes: 2 additions & 3 deletions src/common/1dsClientFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,17 +103,16 @@ export const oneDataSystemClientFactory = async (key: string, vscodeAPI: typeof
},
flush: flushOneDS,
dispose: async () => {
await flushOneDS();
const disposePromise = new Promise<void>((resolve) => {
if (!appInsightsCore) {
resolve();
return;
}
appInsightsCore.unload(true, () => {
appInsightsCore.unload(false, () => {
resolve();
appInsightsCore = undefined;
return;
});
}, 1000);
});
return disposePromise;
}
Expand Down
2 changes: 1 addition & 1 deletion src/node/telemetryReporter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const appInsightsClientFactory = async (key: string, replacementOptions?: Replac
}
},
dispose: async () => {
appInsightsClient?.flush();
appInsightsClient?.flush({ isAppCrashing: true });
appInsightsClient = undefined;
}
};
Expand Down

0 comments on commit e17e9ed

Please sign in to comment.