1 | <?php |
||
9 | class JobManager extends AbstractJobManager |
||
10 | { |
||
11 | const DEFAULT_RESERVE_TIMEOUT = 5; // seconds |
||
12 | |||
13 | /** @var Pheanstalk */ |
||
14 | protected $beanstalkd; |
||
15 | |||
16 | protected $tube; |
||
17 | |||
18 | protected $reserveTimeout = self::DEFAULT_RESERVE_TIMEOUT; |
||
19 | |||
20 | 2 | public function setBeanstalkd(Pheanstalk $beanstalkd) |
|
21 | { |
||
22 | 2 | $this->beanstalkd = $beanstalkd; |
|
23 | 2 | } |
|
24 | |||
25 | public function setTube($tube) |
||
29 | |||
30 | public function setReserveTimeout($timeout) |
||
34 | |||
35 | 6 | public function save(\Dtc\QueueBundle\Model\Job $job) |
|
53 | |||
54 | 6 | public function getBeanJob($jobId, $data) |
|
58 | |||
59 | 6 | /** |
|
60 | * @param string|null $workerName |
||
61 | 6 | * @param string|null $methodName |
|
62 | * @param bool $prioritize |
||
63 | * @param int|string|null $runId |
||
64 | * |
||
65 | 6 | * @return Job|null |
|
66 | 6 | * |
|
67 | * @throws \Exception |
||
68 | */ |
||
69 | public function getJob($workerName = null, $methodName = null, $prioritize = true, $runId = null) |
||
88 | |||
89 | 3 | /** |
|
90 | 3 | * @param Pheanstalk $beanstalkd |
|
91 | * @param bool $expiredJob |
||
92 | 2 | * @param int|string|null $runId |
|
93 | * |
||
94 | 2 | * @return Job|null |
|
95 | 2 | */ |
|
96 | 2 | protected function findJob(Pheanstalk $beanstalkd, &$expiredJob, $runId) |
|
118 | |||
119 | public function deleteJob(\Dtc\QueueBundle\Model\Job $job) |
||
124 | |||
125 | // Save History get called upon completion of the job |
||
126 | public function saveHistory(\Dtc\QueueBundle\Model\Job $job) |
||
133 | |||
134 | public function getStats() |
||
138 | } |
||
139 |
In PHP, under loose comparison (like
==
, or!=
, orswitch
conditions), values of different types might be equal.For
string
values, the empty string''
is a special case, in particular the following results might be unexpected: