I have a web application written using Laravel 5.1 that runs a script when a user requests a certain page or clicks a button. This should activate the script in the background. I have tried this using Jobs & queues.
Here is my code chunk: myjob.php
class myjob extends Job implements SelfHandling, ShouldQueue {
use InteractsWithQueue, SerializesModels;
/**
* Create a new job instance.
*
* @return void
*/
public function __construct()
{
//
}
/**
* Execute the job.
*
* @return void
*/
public function handle()
{
//
set_time_limit(0);
$this->writeJobLogs('Error', 'Start Execution');
//Job Processing Code
$this->writeJobLogs('Error', 'End Execution');
}
}
Controller.php
class ManageController extends Controller {
public function testJob(){
$this->dispatch(new myjob());
}
}
Job Processing Code is expected to take at least 10 minutes to get executed. Now when I run the code it throws error after which is given below:
[Symfony\Component\Process\Exception\ProcessTimedOutException] The process ""C:\wamp\bin\php\php5.5.12\php.exe" "artisan" queue:work --queue="default" --delay=0 --memory=128 --sleep=3 --tries=0 --env="local"" exceeded the timeout of 60 seconds.
& Job Processing Code is expected to be executed multiple times simultaneously, respective to the user requests. So I have a doubt regarding that if queues will be working fine or I have any other better choice. If so, please suggest.