Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion src/Provider/ClockworkServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
use Clockwork\Support\Vanilla\Clockwork;
use Flarum\Foundation\Paths;
use Flarum\Group\Group;
use Flarum\Queue\RoutingQueue;
use Flarum\Settings\SettingsRepositoryInterface;
use FoF\Clockwork\Clockwork\FlarumAuthenticator;
use FoF\Clockwork\Clockwork\FlarumDataSource;
Expand Down Expand Up @@ -85,9 +86,16 @@ public function boot(): void
public function register()
{
$this->app->singleton('clockwork.queue', function ($app) {
/** @var \Illuminate\Queue\Queue $connection */
$connection = $app->make('flarum.queue.connection');

// Flarum wraps the connection to route jobs onto their queues. The
// wrapper implements only the queue contract, and Clockwork needs
// the driver underneath (it calls createPayloadUsing on it).
if ($connection instanceof RoutingQueue) {
$connection = $connection->getDriver();
}

/** @var \Illuminate\Queue\Queue $connection */
return new LaravelQueueDataSource($connection);
});

Expand Down
Loading