changed running in queue detection

This commit is contained in:
Denis Duliçi 2023-11-07 18:38:11 +03:00
parent c394f81c52
commit 9ce3286be8
2 changed files with 5 additions and 5 deletions

View File

@ -37,10 +37,6 @@ class Queue extends Provider
});
app('events')->listen(JobProcessing::class, function ($event) {
if (! defined('APP_RUNNING_IN_QUEUE')) {
define('APP_RUNNING_IN_QUEUE', true);
}
$payload = $event->job->payload();
if (! array_key_exists('company_id', $payload)) {

View File

@ -171,7 +171,11 @@ if (! function_exists('running_in_queue')) {
*/
function running_in_queue(): bool
{
return defined('APP_RUNNING_IN_QUEUE') ?? false;
return app()->runningConsoleCommand([
'queue:work',
'queue:listen',
'horizon',
]);
}
}