mongodb-js / connection-model

MongoDB connection model.
Apache License 2.0
10 stars 5 forks source link

fix: Wait for the tunnel to close before finishing client close COMPASS-4474 #352

Closed gribnoysup closed 3 years ago

gribnoysup commented 3 years ago

Replaces ssh-tunnel implementation with @mongodb-js/ssh-tunnel and safely overrides driver close* to always wait for tunnel to close before resolving the callback. That way we can always be sure that tunnel is completely stopped before allowing for another connection to be open through a tunnel with the same port in e.g., Compass

* - I considered other options how to achieve that (for example, exposing tunnel with the client from the connect callback and then awaiting explicitly on it in data-service), but overriding close on client still feels like a better balance between how much stuff is exposed from the connection-model and "hackiness" of the implementation

gribnoysup commented 3 years ago

After discussing F2F we decided to go with the exposing the tunnel from the connect method option