Repository navigation
feat(broker): make the broker visibility timeout configurable - #41
Merged
Merged
Conversation
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.
webjunkie
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Kombu's Redis transport restores unacknowledged messages from every consumer: after a poll with no new messages, it re-queues entries in
unackedolder than the channel'svisibility_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_latetasks 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
BROKER_VISIBILITY_TIMEOUTenv var (seconds). When set, it goes intobroker_transport_optionsof both Celery apps: the event subscription and the control/inspect app. Unset keeps kombu's default, so nothing changes for existing setups._make_events_app(), next to_make_control_app().How did you test this code?
Agent-authored.
uv run pytest -qpasses (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) whenBROKER_VISIBILITY_TIMEOUT=21600.🤖 Generated with Claude Code