From 09fdd4cb6dcc7acfe72e908f98ca69b57f151bd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Tue, 16 Nov 2021 16:46:31 +0100 Subject: [PATCH] fix: allow queue restarting (#3166) 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. --- src/Queue/QueueServiceProvider.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Queue/QueueServiceProvider.php b/src/Queue/QueueServiceProvider.php index c77bd73f5..19377e430 100644 --- a/src/Queue/QueueServiceProvider.php +++ b/src/Queue/QueueServiceProvider.php @@ -67,7 +67,7 @@ class QueueServiceProvider extends AbstractServiceProvider /** @var Config $config */ $config = $container->make(Config::class); - return new Worker( + $worker = new Worker( $container[Factory::class], $container['events'], $container[ExceptionHandling::class], @@ -75,6 +75,10 @@ class QueueServiceProvider extends AbstractServiceProvider return $config->inMaintenanceMode(); } ); + + $worker->setCache($container->make('cache.store')); + + return $worker; }); // Override the Laravel native Listener, so that we can ignore the environment