Deploy: health check wacht tot ongeveer 2 minuten (40 pogingen van 3 s, 5 s per verzoek)
Een opstart duurt normaal 10 s maar was 22 tot 29 s toen twee services kort na elkaar herstartten op een drukke Pi; 10 pogingen waren dan te weinig. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -228,20 +228,24 @@ jobs:
|
|||||||
systemctl --user restart ${{ inputs.service_name }}"
|
systemctl --user restart ${{ inputs.service_name }}"
|
||||||
|
|
||||||
# Verifies the restart actually produced a healthy process before this run is allowed to
|
# Verifies the restart actually produced a healthy process before this run is allowed to
|
||||||
# report success. Retries absorb ordinary process-startup time; a run that never turns healthy
|
# report success. Retries absorb process-startup time, which is about 10 seconds normally but
|
||||||
# fails the job without touching `current` or pruning (see below) — no automatic rollback.
|
# 30 seconds or more when the host is busy (a migration step, two services restarting at once
|
||||||
# A previous release is always still on disk to restore from manually (D-26).
|
# on one machine): up to 40 attempts, 3 seconds apart (about 2 minutes), each request limited
|
||||||
|
# to 5 seconds so one hanging attempt cannot eat the whole window. A run that never turns
|
||||||
|
# healthy fails the job without touching `current` or pruning (see below) - no automatic
|
||||||
|
# rollback. A previous release is always still on disk to restore from manually (D-26).
|
||||||
- name: Verify /health
|
- name: Verify /health
|
||||||
run: |
|
run: |
|
||||||
for attempt in $(seq 1 10); do
|
attempts=40
|
||||||
if curl -f -s -o /dev/null "${{ inputs.health_check_url }}"; then
|
for attempt in $(seq 1 $attempts); do
|
||||||
|
if curl -f -s --max-time 5 -o /dev/null "${{ inputs.health_check_url }}"; then
|
||||||
echo "Health check passed on attempt $attempt"
|
echo "Health check passed on attempt $attempt"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
echo "Health check attempt $attempt failed, retrying..."
|
echo "Health check attempt $attempt of $attempts failed, retrying..."
|
||||||
sleep 3
|
sleep 3
|
||||||
done
|
done
|
||||||
echo "Health check did not pass after 10 attempts"
|
echo "Health check did not pass after $attempts attempts"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
# Retention: keep `current` plus exactly one previous release, so a manual rollback is always
|
# Retention: keep `current` plus exactly one previous release, so a manual rollback is always
|
||||||
|
|||||||
Reference in New Issue
Block a user