Skip to content

[2.x] fix: Unwrap RoutingQueue when identifying the queue driver - #4855

Merged
imorland merged 1 commit into
2.xfrom
im/queue-driver-unwrap-routing-queue
Jul 29, 2026
Merged

[2.x] fix: Unwrap RoutingQueue when identifying the queue driver#4855
imorland merged 1 commit into
2.xfrom
im/queue-driver-unwrap-routing-queue

Conversation

@imorland

Copy link
Copy Markdown
Member

Why

#4853 wraps the queue connection in a RoutingQueue so push() can be routed by job class. ApplicationInfoProvider::identifyQueueDriver() derives the driver name from the connection's class name, so with the wrapper in place it now reports routing instead of the real backend (redis/database/sync).

This is visible on every 2.x site:

$ php flarum info
...
Queue driver: routing      # should be: redis / database / sync

It also surfaces on the admin dashboard, and it breaks downstream code that keys off the reported driver — e.g. fof/horizon relabels redisRedis + Horizon and gates its admin controls on that, so those controls silently disappear.

What

Unwrap a RoutingQueue via its public getDriver() before reading the class name, so the reported driver reflects the actual backend again:

$queue = $this->queue instanceof RoutingQueue
    ? $this->queue->getDriver()
    : $this->queue;
$queue = $queue::class;
// ...strip namespace, lowercase, drop 'queue'

Tests

ApplicationInfoProviderTest gains:

  • queue_driver_is_derived_from_the_connection_class — a bare SyncQueue reports sync.
  • queue_driver_reports_the_real_driver_when_wrapped_in_a_routing_queue — a SyncQueue wrapped in a RoutingQueue still reports sync, not routing.

The provider() helper takes an optional queue instance so a specific connection can be injected.

Full ApplicationInfoProviderTest green (8 tests). Verified live: php flarum info reports redis again on a redis-backed stack.

Regression from

#4853 (the RoutingQueue connection wrapper).

The queue connection is wrapped in a RoutingQueue (#4853) so pushes can be
routed by job class. identifyQueueDriver() derived the driver name from the
connection's class, so it began reporting 'routing' instead of the real
backend (redis/database/sync) in `flarum info` and the admin dashboard.

Unwrap a RoutingQueue via its public getDriver() before reading the class
name, so the reported driver reflects the actual backend again.
@imorland
imorland requested a review from a team as a code owner July 29, 2026 15:16
@imorland imorland changed the title Unwrap RoutingQueue when identifying the queue driver [2.x] fix: Unwrap RoutingQueue when identifying the queue driver Jul 29, 2026
@imorland imorland added this to the 2.0.0-rc.6 milestone Jul 29, 2026
@imorland
imorland merged commit ba11aa9 into 2.x Jul 29, 2026
25 checks passed
@imorland
imorland deleted the im/queue-driver-unwrap-routing-queue branch July 29, 2026 15:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant