Repository navigation
[2.x] fix: give Clockwork the queue driver under Flarum's routing wrapper - #48
Merged
Merged
Conversation
With a database or Redis queue, Flarum 2 wraps the connection in a RoutingQueue, which implements only the queue contract. Clockwork's LaravelQueueDataSource requires Illuminate\Queue\Queue, so building it threw a TypeError on every web request. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
imorland
approved these changes
Oct 10, 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.
Fixes #0000 (no issue; found during an N+1 audit of FoF's 2.x extensions)
Changes proposed in this pull request:
With an async queue driver (
database, or Redis through fof/redis or fof/horizon), Flarum 2 wrapsflarum.queue.connectioninFlarum\Queue\RoutingQueueso that jobs are routed onto their registered queues. The wrapper implements onlyIlluminate\Contracts\Queue\Queue. Clockwork'sLaravelQueueDataSourcetype-hints the concreteIlluminate\Queue\Queue(it callscreatePayloadUsingon it), so the provider's boot threw on every web request:The provider now hands Clockwork the wrapped driver (
RoutingQueue::getDriver()). The sync driver is never wrapped, so sites on it were not affected and see no change. On a core that predatesRoutingQueue, theinstanceofcheck is simply false.Reviewers should focus on:
Core does the same unwrap internally (
QueueServiceProvider::unwrapQueue()), for the same reason.Tested on Flarum 2.0.0-rc.8 (Composer install, MariaDB, all FoF 2.x extensions enabled), with
queue.driverset todatabase:/api/discussions/With the
syncdriver, both answer 200. PHPStan is clean. The extension has no test suite.Confirmed
🤖 Generated with Claude Code