Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

patrikw1's avatar

Laravel second task schedule never runs

I have cron entry at shared hosting:

          • php web/artisan schedule:run

The problem is that queue:work command works no matter the order, but second task (Closure) that updates video views never runs.

Code from Kernel.php:


/**
 * Define the application's command schedule.
 *
 * @param  \Illuminate\Console\Scheduling\Schedule  $schedule
 * @return void
 */
protected function schedule(Schedule $schedule)
{

    //Each Video total_video_views will be accurately updated on daily basis.
    $schedule->call(function () {
       $videos = Video::get();
       app('queue')->pushOn('high', new UpdateVideoViews($videos));

    })->hourlyAt('30')
      ->name('updates all video views')
      ->withoutOverlapping();

    //this is alternative to supervisor since shared hosting someties doesnt provide supervisor
    //so we use cron instead to keep queue worker up
    $schedule->command('queue:work --queue=high,default')
        ->everyMinute()
        ->name('keeps queue worker active')
        ->withoutOverlapping();

}

Is there any way to run it? My suspiction is that queue:work command along "withoutOverlapping()" is kinda maybe blocking any other tasks to process.

0 likes
5 replies
Snapey's avatar

does queue:work actually return? is it not designed to keep running? your withoutOverlapping will leave a mutex behind that stops other schedules.

patrikw1's avatar

Snappey, yes but i cannot use supervisor to keep queue:work active, since i am on shared hosting, thats why i have to use task scheduler

Snapey's avatar

Why not just do the work (updateVideoViews) in the cron rather than creating a job on a queue and then trying to process the queue?

patrikw1's avatar

My application is using queue for multiple segments, for example sending email notifications, converting videos, interacting with third part services you know,

but until now, i had nothing else in task scheduler except triggering one command - queue:work because everything else, every other jobs are dispatched by event listeners, and event listeners are triggered by users or webhooks that do something, for example Eloquent video create event will trigger multiple listeners, and put some jobs on the queue, queue then picks them up and process them as usual.

So yea, are you saying that i should probably skip running (updateVideoViews) "php artisan schedule:task" in task scheduler, but instead, create new entry in cron job, and set interval for example to every hour.. and that new entry will execute command "php artisan videos:update-views"?

I think it would work, but why not use task scheduler where you create one cron entry and you are good to go. If i use workaround it's like in the past.. so for each task you have to create cron entry and thats not what i want :(

Snapey's avatar
Snapey
Best Answer
Level 122

then you need to switch to a host that allows you to run supervisor in a separte thread

Please or to participate in this conversation.