Skip to content

Commit 570d630

Browse files
Copilottorosent
andcommitted
Use bash /dev/tcp for more portable health check
Address code review feedback: - Replace nc with bash's /dev/tcp for portability - Rename max_attempts to MAX_WAIT_SECONDS with comment - Add comment explaining the TCP check mechanism Co-authored-by: torosent <[email protected]>
1 parent 19df1cd commit 570d630

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

.github/workflows/build-validation.yml

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,19 +86,21 @@ jobs:
8686
- name: Wait for Durable Task Emulator to be ready
8787
run: |
8888
echo "Waiting for Durable Task Emulator to be ready on port 4001..."
89-
max_attempts=60
89+
# Maximum wait time of 60 seconds for emulator startup
90+
MAX_WAIT_SECONDS=60
9091
attempt=0
91-
while ! nc -z localhost 4001 2>/dev/null; do
92+
# Use bash's /dev/tcp for portability instead of nc
93+
while ! (echo > /dev/tcp/localhost/4001) 2>/dev/null; do
9294
attempt=$((attempt + 1))
93-
if [ $attempt -ge $max_attempts ]; then
94-
echo "ERROR: Emulator not ready after $max_attempts seconds"
95+
if [ $attempt -ge $MAX_WAIT_SECONDS ]; then
96+
echo "ERROR: Emulator not ready after $MAX_WAIT_SECONDS seconds"
9597
echo "Docker container status:"
9698
docker ps -a
9799
echo "Container logs:"
98100
docker logs durabletask-emulator 2>&1 | tail -50
99101
exit 1
100102
fi
101-
echo "Attempt $attempt/$max_attempts - waiting for emulator..."
103+
echo "Attempt $attempt/$MAX_WAIT_SECONDS - waiting for emulator..."
102104
sleep 1
103105
done
104106
echo "Durable Task Emulator is ready on port 4001"

0 commit comments

Comments
 (0)