From 56342dc8e0097ecd3fd02cc6cbbe2c5c9d4bf355 Mon Sep 17 00:00:00 2001 From: jfanals Date: Mon, 24 Jun 2024 12:26:18 +0100 Subject: [PATCH] fix: Ensure SSH connections are closed after each command execution This commit addresses an issue where SSH connections were not being properly closed after each command execution, leading to timeout errors during the `kamal deploy` process. --- lib/kamal/sshkit_with_ext.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/kamal/sshkit_with_ext.rb b/lib/kamal/sshkit_with_ext.rb index 2d0257a87..e1aafb5f2 100644 --- a/lib/kamal/sshkit_with_ext.rb +++ b/lib/kamal/sshkit_with_ext.rb @@ -118,6 +118,8 @@ def execute rescue ::StandardError => e e2 = SSHKit::Runner::ExecuteError.new e raise e2, "Exception while executing #{host.user ? "as #{host.user}@" : "on host "}#{host}: #{e.message}" + ensure + SSHKit::Backend::Netssh.pool.close_connections end end