CLI - Add a 1 second timeout for flushing the telemetry (#97622)

* Add a 1 second timeout for flushing the telemetry
This commit is contained in:
Ladislau Szomoru 2020-05-13 10:56:28 +02:00 committed by GitHub
parent e9d4c979ca
commit 16460ceb51
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -4,6 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { localize } from 'vs/nls';
import { raceTimeout } from 'vs/base/common/async';
import product from 'vs/platform/product/common/product';
import * as path from 'vs/base/common/path';
import * as semver from 'semver-umd';
@ -361,8 +362,10 @@ export async function main(argv: ParsedArgs): Promise<void> {
try {
await main.run(argv);
// Flush the remaining data in AI adapter.
await combinedAppender(...appenders).flush();
// If it does not complete in 1 second, exit the process.
await raceTimeout(combinedAppender(...appenders).flush(), 1000);
} finally {
disposables.dispose();
}