Skip to content

Commit ede7dc4

Browse files
gkorlandCopilot
andcommitted
fix: add configurable timeout to FalkorDB wait loop
The wait loop could block forever if FalkorDB never became reachable. Now uses FALKORDB_WAIT_TIMEOUT (default 30s) via the bash SECONDS variable to track elapsed time, logging a clear error message and exiting non-zero if the timeout is exceeded. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 0096860 commit ede7dc4

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

start.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ if [ "${FALKORDB_HOST}" = "localhost" ] || [[ "${FALKORDB_HOST}" =~ ^127\.0\.0\.
1111
fi
1212

1313
# Wait until FalkorDB is ready
14-
echo "Waiting for FalkorDB to start on $FALKORDB_HOST:$FALKORDB_PORT..."
14+
FALKORDB_WAIT_TIMEOUT="${FALKORDB_WAIT_TIMEOUT:-30}"
15+
echo "Waiting for FalkorDB to start on $FALKORDB_HOST:$FALKORDB_PORT (timeout: ${FALKORDB_WAIT_TIMEOUT}s)..."
1516

17+
SECONDS=0
1618
while ! nc -z "$FALKORDB_HOST" "$FALKORDB_PORT"; do
19+
if [ "$SECONDS" -ge "$FALKORDB_WAIT_TIMEOUT" ]; then
20+
echo "ERROR: FalkorDB did not become reachable at $FALKORDB_HOST:$FALKORDB_PORT within ${FALKORDB_WAIT_TIMEOUT}s" >&2
21+
exit 1
22+
fi
1723
sleep 0.5
1824
done
1925

0 commit comments

Comments
 (0)