Skip to content

Commit

Permalink
Remove unnecessary awaits (#15608)
Browse files Browse the repository at this point in the history
  • Loading branch information
DonJayamanne authored Apr 26, 2024
1 parent c6c50c0 commit eda29e7
Showing 1 changed file with 9 additions and 15 deletions.
24 changes: 9 additions & 15 deletions src/kernels/raw/launcher/kernelLauncher.node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,22 +113,16 @@ export class KernelLauncher implements IKernelLauncher {
cancelToken: CancellationToken
): Promise<IKernelProcess> {
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;
}

Expand Down

0 comments on commit eda29e7

Please sign in to comment.