Skip to content

fix(cleanup): stop the instance once its service is deleted - #20

Merged
BotellaA merged 2 commits into
nextfrom
fix/stop_instance_after_delete
Nov 26, 2026
Merged

BotellaA merged 2 commits into
nextfrom
fix/stop_instance_after_delete

Conversation

@BotellaA

Copy link
Copy Markdown
Member

Why

In Vease cloud sessions, once /geode/health returned 500, cleanup.bash deleted the Cloud Run service and exited — but supervisor (autorestart=true) restarted it, giving ~110 DELETE calls per session that all returned 404 (8,000+/day, some throttled with RESOURCE_EXHAUSTED). Meanwhile the instance kept running (2 vCPU, always on) until its open requests (e.g. the back's /events stream) hit the 3600 s request timeout. Nightly e2e sessions that should last 3–5 min were billed ~60 min each.

What

  • Delete accepted (2xx) or service already gone (404) → supervisorctl shutdown, so the container exits and the instance stops immediately.
  • Any other delete failure → return non-zero and keep the previous retry behaviour.

Tests

Built the image locally and checked that supervisorctl -c /etc/supervisord.conf shutdown stops the container (exit 0).

Root-cause fix in OpenGeodeWeb-Back: event streams now close once the server timed out.

🤖 Generated with Claude Code

After deleting the service, the script exited and supervisor restarted
it into a loop of 404 deletes, while the instance stayed up (and billed)
until its open requests reached the 3600 s timeout. Shut supervisord
down once the delete is accepted or the service is already gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@BotellaA
BotellaA merged commit 93bbd77 into next Nov 26, 2026
25 checks passed
@BotellaA
BotellaA deleted the fix/stop_instance_after_delete branch November 26, 2026 14:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants