diff --git a/src/babashka/wait.clj b/src/babashka/wait.clj index dbf54d2b..af2cc9d4 100644 --- a/src/babashka/wait.clj +++ b/src/babashka/wait.clj @@ -17,8 +17,8 @@ opts) t0 (System/currentTimeMillis)] (loop [] - (let [v (try (Socket. host port) - (- (System/currentTimeMillis) t0) + (let [v (try (with-open [_ (Socket. host port)] + (- (System/currentTimeMillis) t0)) (catch ConnectException _e (let [took (- (System/currentTimeMillis) t0)] (if (and timeout (>= took timeout))