From a062026db1993cbd1283c8db9fcb6a445a03b302 Mon Sep 17 00:00:00 2001 From: Charlie Lye Date: Mon, 6 Nov 2023 12:45:36 +0000 Subject: [PATCH] fix: Attempt to fix spot request hangs. (#3241) As title. --- build-system/scripts/request_spot | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/build-system/scripts/request_spot b/build-system/scripts/request_spot index 9e35b9b769a..3eef009d8ab 100755 --- a/build-system/scripts/request_spot +++ b/build-system/scripts/request_spot @@ -110,11 +110,11 @@ done # Wait till ssh port is open. >&2 echo "Waiting for SSH at $IP..." -for I in {1..60}; do - if nc -z $IP 22; then - echo $IP - exit 0 +SECONDS=0 +while ! nc -z -w1 $IP 22; do + if (( SECONDS >= 60 )); then + >&2 echo "Timeout: SSH port 22 at $IP did not become available after 60 seconds." + exit 1 fi - sleep 1 done -exit 1 +echo $IP \ No newline at end of file