forked from skylerkatz/hover
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathWorker.php
32 lines (26 loc) · 871 Bytes
/
Worker.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
use Illuminate\Queue\Worker as LaravelWorker;
use Illuminate\Queue\WorkerOptions;
class Worker extends LaravelWorker
{
protected function daemonShouldRun(WorkerOptions $options, $connectionName, $queue)
{
return true;
}
public function kill($status = 0)
{
throw new Exception('Job timed out. It will be retried again.');
}
protected function getNextJob($connection, $queue)
{
return QueueEventProcessor::$currentJob;
}
protected function timeoutForJob($job, WorkerOptions $options)
{
return min(parent::timeoutForJob($job, $options), $options->timeout);
}
protected function stopIfNecessary(WorkerOptions $options, $lastRestart, $startTime = 0, $jobsProcessed = 0, $job = null)
{
return $options->maxJobs && $jobsProcessed >= $options->maxJobs ? 0 : null;
}
}