From eda29e7b11e09464943ca7609727d97e7f951607 Mon Sep 17 00:00:00 2001 From: Don Jayamanne Date: Fri, 26 Apr 2024 20:07:11 +1000 Subject: [PATCH] Remove unnecessary awaits (#15608) --- .../raw/launcher/kernelLauncher.node.ts | 24 +++++++------------ 1 file changed, 9 insertions(+), 15 deletions(-) diff --git a/src/kernels/raw/launcher/kernelLauncher.node.ts b/src/kernels/raw/launcher/kernelLauncher.node.ts index 81074790d60..df7145ab88d 100644 --- a/src/kernels/raw/launcher/kernelLauncher.node.ts +++ b/src/kernels/raw/launcher/kernelLauncher.node.ts @@ -113,22 +113,16 @@ export class KernelLauncher implements IKernelLauncher { cancelToken: CancellationToken ): Promise { const stopWatch = new StopWatch(); - const promise = (async () => { - this.logIPyKernelPath(resource, kernelConnectionMetadata, cancelToken).catch(noop); - - // Should be available now, wait with a timeout - return await this.launchProcess(kernelConnectionMetadata, resource, workingDirectory, timeout, cancelToken); - })(); - promise - .then(() => - /* No need to send telemetry for kernel launch failures, that's sent elsewhere */ - sendTelemetryEvent( - Telemetry.KernelLauncherPerf, - { duration: stopWatch.elapsedTime }, - { resourceType: getResourceType(resource) } - ) + this.logIPyKernelPath(resource, kernelConnectionMetadata, cancelToken).catch(noop); + const promise = this.launchProcess(kernelConnectionMetadata, resource, workingDirectory, timeout, cancelToken); + void promise.then(() => + /* No need to send telemetry for kernel launch failures, that's sent elsewhere */ + sendTelemetryEvent( + Telemetry.KernelLauncherPerf, + { duration: stopWatch.elapsedTime }, + { resourceType: getResourceType(resource) } ) - .catch(noop); + ); return promise; }