Skip to content

feat: Add worker retry mechanic for database connection #20

@eelkevdbos

Description

@eelkevdbos

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions