imTigger / laravel-job-status

Add ability to track Job progress, status and result dispatched to Queue.
MIT License
407 stars 60 forks source link

When using scheduler a new entry in job_statuses is created #31

Closed HamzaDevz closed 4 years ago

HamzaDevz commented 5 years ago

Hello, First thanks for this library.

When I'm using $schedule->job(new MyJob(['params'])->days() in Kernel.php and php artisan schedule:run for scheduling it creates a new entry in job_statuses table.

Currently i found a workaround, i'm sending a new param to the Job ('withoutProgress') that act as a flag and didn't execute the function prepareStatus, but to me it's ugly.

Is it possible to make prepareStatus function not executed when it comes from the scheduler ?

I'm on Laravel 5.8 - Php 7.2

crashkonijn commented 5 years ago

I think this would solve your problem as well; It's just a little bit more code then the dedicated method.

$schedule->call(function () {
    MyJob::dispatch(['params']);
})->daily();