Fix removing tunnels when the tunnel factory throws an error (#186566)

* Await the tunnel promise

* Add null check

* nit: use undefined

---------

Co-authored-by: Alex Ross <alros@microsoft.com>
This commit is contained in:
Josh Abernathy
2023-06-29 20:06:41 +00:00
committed by GitHub
co-authored by Alex Ross
parent a3231fc857
commit 661fbc9ecf
+1 -1
View File
@@ -416,7 +416,7 @@ export abstract class AbstractTunnelService implements ITunnelService {
const hostMap = this._tunnels.get(remoteHost);
if (hostMap) {
const tunnel = hostMap.get(remotePort);
const tunnelResult = await tunnel;
const tunnelResult = tunnel ? await tunnel.value : undefined;
if (!tunnelResult) {
hostMap.delete(remotePort);
}