Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions dev2/c0mpute-gateway/c0mpute-gateway-watchdog
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,20 @@ for wait in 0 1 1 2 3 5; do
ok && exit 0
done

# A worker that started recently is still coming up: since 0.3.136 it brings its
# apps up before it opens :7777, which took 3.5 min on 2026-11-30. Restarting it
# inside that window only starts the wait again (it looped every 2 min for 15 min
# and took every Moshpit name on c0mpute down). Leave it alone for GRACE seconds.
GRACE="${C0MPUTE_GATEWAY_GRACE:-480}"
if systemctl is-active --quiet "$UNIT"; then
since=$(systemctl show -p ActiveEnterTimestampMonotonic --value "$UNIT" 2>/dev/null || echo 0)
now=$(awk '{printf "%d", $1 * 1000000}' /proc/uptime)
if [ "${since:-0}" -gt 0 ] && [ $(( (now - since) / 1000000 )) -lt "$GRACE" ]; then
log "$URL not answering yet, but $UNIT started $(( (now - since) / 1000000 )) s ago (grace ${GRACE} s); waiting"
exit 0
fi
fi

# Someone may be running a worker by hand on :7777 (a session relaunch). It is not
# answering either, so the unit is the one to bring back.
if systemctl is-active --quiet "$UNIT"; then
Expand Down
Loading