Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: databasetesting.CreateForDevel() now tries to connect for 10s #886

Merged
merged 1 commit into from
Feb 7, 2024

Conversation

alecthomas
Copy link
Collaborator

There seems to be a race between when the Docker PG healthcheck passes, and when the Docker port becomes available:

trace: exec: cd . && docker inspect --format \{\{.State.Health.Status}} ftl-db-1
debug: Postgres DSN: ***localhost:54320/ftl?sslmode=disable
ftl: error: failed to connect to `host=localhost user=postgres database=`: failed to receive message (unexpected EOF)

It's not clear if that's a deficiency in Docker, or perhaps pg_isready is only checking the Unix socket and not the TCP port, and there's some delay between the two becoming available. Either way, this should solve it.

There seems to be a race between when the Docker PG healthcheck passes,
and when the Docker port becomes available:

    trace: exec: cd . && docker inspect --format \{\{.State.Health.Status}} ftl-db-1
    debug: Postgres DSN: ***localhost:54320/ftl?sslmode=disable
    ftl: error: failed to connect to `host=localhost user=postgres database=`: failed to receive message (unexpected EOF)

It's not clear if that's a deficiency in Docker, or perhaps pg_isready
is only checking the Unix socket and not the TCP port, and there's some
delay between the two becoming available. Either way, this should solve
it.
@alecthomas alecthomas merged commit 18e861e into main Feb 7, 2024
11 checks passed
@alecthomas alecthomas deleted the aat/wait-for-db branch February 7, 2024 07:35
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