Skip to content

A self-hosted media server and file management system

fix(experiment): horizon restart method does not work

aminnausince5bfa951eb5
diff --git a/app/Services/Server/QueueControlService.php b/app/Services/Server/QueueControlService.php
index 055a2cf0..bcffdd53 100644
--- a/app/Services/Server/QueueControlService.php
+++ b/app/Services/Server/QueueControlService.php
@@ -2,7 +2,6 @@
namespace App\Services\Server;
-use Illuminate\Support\Facades\Artisan;
use Illuminate\Support\Facades\Log;
use Laravel\Horizon\Contracts\MasterSupervisorRepository;
@@ -10,9 +9,10 @@ class QueueControlService {
public function restart(): void {
try {
if (config('queue.default') === 'redis' && $this->horizonIsRunning()) {
- dispatch(function () {
- Artisan::call('horizon:terminate');
- })->onQueue('high');
+ $php = PHP_BINARY; // uses the same PHP binary the app is running on
+ $artisan = base_path('artisan');
+
+ exec("$php $artisan horizon:terminate > /dev/null 2>&1 &");
}
} catch (\Throwable $th) {
Log::error("Unable to restart Horizon", ["error" => $th->getMessage()]);