When I run php artisan schedule:list
, the scheduled job exists. When I run php artisan queue:work
, the job runs successfully until it times out. But when I run php artisan schedule:work
the console says something like
2024-06-15 09:08:00 Running [AppJobsWordsDatamuseDatamuseAPIFetchResults] 15.90ms DONE
Which suggests the job has run successfully, but nothing actually happens? Here is my handle method:
public function handle(): void
{
Log::info('Fetching results from Datamuse API...');
echo "Fetching results from Datamuse API...";
$this->datamuse->fetchAllSoundsLike();
echo "Done";
}
I have tried adding a log message. When I run the scheduled job nothing gets logged?
2
Answers
I have the same problem with Laravel 11 (no kernel.php in Laravel 11):
this is my case practically the same
I try to see in table failed_jobs, but nothing the table remains empty, It seems like everything works, but in reality the handle() method doesn’t seem to be executed (I also inserted a log into the method for verification).
I do not understand.
When running the command, check if the execution record of the Job has been added to the ‘jobs’ table in Laravel. If it has been added, you need to run the
php artisan queue:work
command to execute the commands in the list.