mirror of
https://github.com/vdsm/virtual-dsm.git
synced 2026-08-28 11:56:03 +00:00
fix: Wait for websocket sockets during startup (#1355)
This commit is contained in:
+14
-5
@@ -136,23 +136,32 @@ startWebsocketServer() {
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Keep the sidecar alive briefly before accepting startup as successful,
|
||||
# surfacing immediate bind or script failures with its captured log.
|
||||
local i
|
||||
for (( i = 1; i <= 5; i++ )); do
|
||||
for (( i = 1; i <= 50; i++ )); do
|
||||
|
||||
if ! isAlive "$pid"; then
|
||||
rm -f -- "$WSD_PID"
|
||||
rm -f -- "$WSD_PID" "$WSD_SOCKET"
|
||||
[ -s "$WSD_LOG" ] && cat "$WSD_LOG" >&2
|
||||
error "Failed to start websocket server!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
[ -S "$WSD_SOCKET" ] && return 0
|
||||
|
||||
sleep 0.1
|
||||
|
||||
done
|
||||
|
||||
return 0
|
||||
pKill "$pid" 2
|
||||
|
||||
if isAlive "$pid"; then
|
||||
kill -9 -- "$pid" 2>/dev/null || :
|
||||
fi
|
||||
|
||||
rm -f -- "$WSD_PID" "$WSD_SOCKET"
|
||||
[ -s "$WSD_LOG" ] && cat "$WSD_LOG" >&2
|
||||
error "Websocket server did not create its socket!"
|
||||
return 1
|
||||
}
|
||||
|
||||
prepareWebFiles
|
||||
|
||||
Reference in New Issue
Block a user