I have job class in my package. Function is simple but time consuming. I'd like send it to run in background.
php artisan queue:work
works.
count = $count; $this->competition = $competition; } public function handle() {
//code body }
}
and in controller
dispatch((new StartLottery($count, $id))->onQueue('high'));
My goal is run this job immediately in background and unlock browser to do another instructions like redirect.
Unfortunately next things are doing after finish job. Finally user wait long time on response from server after his request.
Thanks in advance for any hints how can I move this job to background.
environment:
- Laravel 5.4
- php 5.6
- debian 8