Skip to content

fix: make Celery broker self-heal after Redis switch-over - #210

Open
torkashvand wants to merge 1 commit into
mainfrom
fix/celery-broker-self-healing-redis-switchover
Open

fix: make Celery broker self-heal after Redis switch-over#210
torkashvand wants to merge 1 commit into
mainfrom
fix/celery-broker-self-healing-redis-switchover

Conversation

@torkashvand

@torkashvand torkashvand commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

Make the LSO Celery worker recover automatically after a Redis broker switch-over instead of staying stuck until a manual restart. Previously only broker_connection_retry_on_startup was set, so a connection lost at runtime was never redialed.

A switch-over breaks connections in two ways, both covered here:

The result store gets the same hardening through the top-level redis_* settings. All values are overridable via CELERY_* env vars; tests added. Nothing here ties LSO to Redis — other brokers simply ignore the redis-specific options.

@torkashvand
torkashvand force-pushed the fix/celery-broker-self-healing-redis-switchover branch 2 times, most recently from 63df985 to 81ee14d Compare August 5, 2026 17:31
The LSO Celery worker pins to a single Redis broker URL (a virtual IP in GAP)
and only set broker_connection_retry_on_startup, so when that IP moves between
Redis nodes the broker connection resets and the worker can get stuck until a
manual restart.

Add broker connection retry, an unbounded reconnect limit (None, since Kombu
treats 0 as fail-fast), TCP keep-alive, periodic health checks and
retry-on-timeout on the Redis broker and RedBeat connections so the worker
reconnects automatically. The result store is rpc://, not Redis, so it needs
none of these. Values are overridable via CELERY_* env vars.
@torkashvand
torkashvand force-pushed the fix/celery-broker-self-healing-redis-switchover branch from 81ee14d to 88b5bc4 Compare August 5, 2026 18:49
@torkashvand
torkashvand requested a review from spinoshi August 6, 2026 09:26
@torkashvand torkashvand self-assigned this Aug 6, 2026
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