Skip to content

Log a startup hint for per-attempt execution reconnects - #131

Merged
PhiLily merged 1 commit into
mainfrom
worker-connection-hint
Oct 10, 2026
Merged

PhiLily merged 1 commit into
mainfrom
worker-connection-hint

Conversation

@PhiLily

@PhiLily PhiLily commented Oct 10, 2026

Copy link
Copy Markdown
Member

What and why:

Log one worker_connection_hint INFO record when the worker uses CONN_MAX_AGE = 0 on PostgreSQL without pooling or on MySQL. Include worker_id, database and vendor on the django_ox logger.

The hint reads settings without opening a connection. It is silent on SQLite, with retained connections, or with PostgreSQL pooling. It never prevents startup.

Configuration and compatibility

The execution connection serves task ORM work and outcome writing. Persistence remains opt-in through existing Django settings. Use worker-specific settings when web processes should retain their current configuration. Retained sessions require tasks to restore session state they change.

Default connection lifecycle, transactions, delivery and schema semantics are unchanged. This change adds a diagnostic, not faster defaults.

Validation

Tests exercise the real batch command, connection counts, idle-session disconnect recovery and persistent and default workers sharing a queue. Count tests pin existing behavior; the hint itself opens no connection.

Tests: ran on SQLite, PostgreSQL, pooled PostgreSQL and MySQL; new behaviour is covered by tests/test_connection_count.py, which runs the real ox_worker --batch command and counts driver connections.

Changelog: entry added under Unreleased.

@PhiLily
PhiLily force-pushed the worker-connection-hint branch from f739391 to dedd4f1 Compare October 10, 2026 15:27
Log worker_connection_hint once at INFO during Worker.run() startup
on PostgreSQL without pooling and on MySQL when CONN_MAX_AGE is zero.
Include worker_id, database and vendor. Read settings without opening
a connection or preventing startup.

Keep default connection lifecycle, transactions, delivery and schema
semantics unchanged. Persistence and pooling remain opt-in.
Retained execution sessions carry state between tasks.

Test the hint through the real ox_worker --batch command.
Measure connection counts and idle-session disconnect recovery.
Verify that workers with and without persistence share a queue using
the same django-ox release.
@PhiLily
PhiLily force-pushed the worker-connection-hint branch from dedd4f1 to a111602 Compare October 10, 2026 17:09
@PhiLily
PhiLily merged commit 5aa6c19 into main Oct 10, 2026
36 checks passed
@PhiLily
PhiLily deleted the worker-connection-hint branch October 10, 2026 17:40
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