Context
When using the worker process defined in pyproject.toml like below, it sometimes boots before the database is ready.
[tool.plain.dev.services]
postgres = {cmd = "docker run --name app-postgres ..."}
[tool.plain.dev.run]
worker = {cmd = "uv run plain worker run"}
Resulting in an error like:
plain.models.db.OperationalError: connection failed: connection to server at "127.0.0.1", port 54321 failed: FATAL: the database system is starting up
Proposed solution
Giving the worker a (limited) retry mechanic, for example with tenacity, would greatly improve the reliability of booting.