Skip to content

Wait for the final Postgres server in the hosted spaces check - #75

Merged
j1philli merged 1 commit into
mainfrom
t3/fix-hosted-spaces-pg-race
Oct 26, 2026
Merged

j1philli merged 1 commit into
mainfrom
t3/fix-hosted-spaces-pg-race

Conversation

@j1philli

Copy link
Copy Markdown
Owner

TeamCity CI build 3759 failed in "Hosted space membership policies" with the database system is shutting down.

On first start, the postgres image runs a temporary init server that listens only on the Unix socket and then shuts down. pg_isready over the socket can report ready while that temporary server is up, so the first migration could connect just as it stops.

This change waits for the final server, and runs the migrations against it, over TCP (-h 127.0.0.1), which the temporary server doesn't listen on. It also raises the wait from 30s to 60s.

Verified: bash scripts/ci/test-hosted-spaces.sh passed 3 of 3 runs locally with Docker. The original failure passed when re-run on TeamCity (build 3770), which is consistent with a race.

🤖 Generated with Claude Code

The postgres image's first-run init server answers pg_isready on the Unix
socket and then shuts down, so migrations could hit 'the database system
is shutting down' (TeamCity build 3759). Wait for and connect over TCP,
which only the final server listens on.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@j1philli
j1philli merged commit 68b74de into main Oct 26, 2026
1 check passed
@j1philli
j1philli deleted the t3/fix-hosted-spaces-pg-race branch October 26, 2026 18:17
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.

1 participant