Skip to content

Commit

Permalink
fix: allow queue restarting (#3166)
Browse files Browse the repository at this point in the history
By injecting the cache store into the queue, we allow queues to be
restarted using php flarum queue:restart and similar events dispatched
from within Laravelish classes.
  • Loading branch information
luceos authored Nov 16, 2021
1 parent b4a44f7 commit 09fdd4c
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Queue/QueueServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ public function register()
/** @var Config $config */
$config = $container->make(Config::class);

return new Worker(
$worker = new Worker(
$container[Factory::class],
$container['events'],
$container[ExceptionHandling::class],
function () use ($config) {
return $config->inMaintenanceMode();
}
);

$worker->setCache($container->make('cache.store'));

return $worker;
});

// Override the Laravel native Listener, so that we can ignore the environment
Expand Down

0 comments on commit 09fdd4c

Please sign in to comment.