Skip to content

feat(broker): make the broker visibility timeout configurable - #41

Merged
langesven merged 1 commit into
mainfrom
sl/broker-visibility-timeout
Nov 16, 2026
Merged

langesven merged 1 commit into
mainfrom
sl/broker-visibility-timeout

Conversation

@langesven

Copy link
Copy Markdown
Contributor

Problem

Kombu's Redis transport restores unacknowledged messages from every consumer: after a poll with no new messages, it re-queues entries in unacked older than the channel's visibility_timeout. Phlower consumes the event queue and inspect replies, so it runs that restore too, with kombu's default of 3600 seconds.

When the workers use a longer visibility timeout (to keep long acks_late tasks and tasks with an ETA beyond an hour from running twice), Phlower still re-queues those tasks after one hour, and they run twice.

Changes

  • New BROKER_VISIBILITY_TIMEOUT env var (seconds). When set, it goes into broker_transport_options of both Celery apps: the event subscription and the control/inspect app. Unset keeps kombu's default, so nothing changes for existing setups.
  • The event app is built in _make_events_app(), next to _make_control_app().
  • README: the configuration table documents the variable and says to match the workers' value.

How did you test this code?

Agent-authored. uv run pytest -q passes (32 tests). Two new tests check that the option is absent when unset, and set on both apps (with the control app's socket timeouts kept) when BROKER_VISIBILITY_TIMEOUT=21600.

🤖 Generated with Claude Code

Kombu's Redis transport re-queues unacknowledged tasks older than the
visibility timeout from every consumer, Phlower's event and control
connections included. With kombu's 1h default, Phlower re-delivered tasks
that workers configured with a longer timeout still held. BROKER_VISIBILITY_TIMEOUT
sets it on both connections.
@langesven
langesven requested a review from webjunkie November 16, 2026 14:19
@langesven
langesven merged commit b4796da into main Nov 16, 2026
12 checks passed
@langesven
langesven deleted the sl/broker-visibility-timeout branch November 16, 2026 15:06
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.

2 participants