Timeout settings not kill job in queue:
# php artisan queue:work --queue=sms --timeout=10 --delay=60 --tries=3
[2017-06-13 16:04:11] Processing: App\Jobs\SendAction
[2017-06-13 16:04:28] Processed: App\Jobs\SendAction
I also pass timeout in Job:
class SendAction implements ShouldQueue
{
....
public $timeout = 5;
....
public function handle()
{
for ($x = 0; $x <= 1000000000; $x++) {
$b = 1+1;
} // time for execution 16-18 sec
....
}
My config for queue:
'database' => [
'driver' => 'database',
'table' => 'jobs',
'queue' => 'default',
'retry_after' => 60,
],
You need pcntl php module for this to work... To confirm run:
bash
$ php -m | grep pcntl
You should receive pcntl as return.
There is no mention of this on the docs, might be a good addition there.
Timeouts _also_ require PHP 7.1 to work.
Ref: Worker::registerTimeoutHandler
Ref: Worker::supportsAsyncSignals
Thanks!!! Work fine I have already installed pcntl, update php to PHP 7.1.6 and now it works fine, proccess kill and I restart it by Supervisor!
P.S.:I find it worthwhile to describe these queuing requirements in the documentation regarding the version of PHP and installing the pcntl module.
Please open a PR in the docs repo, thanks everyone.
Most helpful comment
You need
pcntlphp module for this to work... To confirm run:bash $ php -m | grep pcntlYou should receive
pcntlas return.