but nothing within handle is executed
How do you know this?
Also, did you restart the queue worker on production after your code changed (this may be moot depending on your deployment process).
Hello ,
In my local sever (Homestead) everything works fine !
But on the prod server when try to run a queue job it's not working at all !
Lets start from the route :
Route::get('test', function () {
for($currentPage = 1; $currentPage <= 5; $currentPage++){
$delay = \DB::table('jobs')->count() * 20;
dispatch(new App\Jobs\ImportCompaniesTeamLeaderJob($currentPage))->delay($delay+1);
}
});
ImportCompaniesTeamLeaderJob
<?php
namespace App\Jobs;
use App\CustomClass\Teamleader\Sync\CompanySync;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
class ImportCompaniesTeamLeaderJob implements ShouldQueue
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
protected $page;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct($page)
{
$this->page = $page;
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
$company = new CompanySync();
$company->addOrUpdate(true, $this->page, 20);
}
}
public function addOrUpdate($manual = false, $pageNumber = 1, $pageSize = 20)
{
(...)
foreach ($companiesTeamleader["data"] as $cKey => $cValue) {
activity()->log("------UPDATE API page($pageNumber, $pageSize)---------->".$cValue["id"]);
(...)
}
}
on Local server (Homestead) I could see the result of activity()->log("------UPDATE API page($pageNumber, $pageSize)---------->".$cValue["id"]);
------UPDATE API page(1, 20)---------->bc74270c-90d5-0184-9f78-6a384259b4a9
------UPDATE API page(1, 20)---------->4ceb7ef2-ea38-0be4-9c78-be6a42361fe5
(..)
In jobs table I see a related row to this queue and after 20 sec (delay) it disappears which is normal and there is nothing in failed_jobs table which means everything is okay ! but nothing within handle is executed !
Any suggestion ?
but nothing within handle is executed
How do you know this?
Also, did you restart the queue worker on production after your code changed (this may be moot depending on your deployment process).
Please or to participate in this conversation.