@@ -48,12 +48,12 @@ discard block |
||
| 48 | 48 | { |
| 49 | 49 | $config = $this->di->get('config')->beanstalk; |
| 50 | 50 | $port = $config->port; |
| 51 | - if ( ! empty($this->port) && is_numeric($this->port)) { |
|
| 51 | + if (!empty($this->port) && is_numeric($this->port)) { |
|
| 52 | 52 | $port = $this->port; |
| 53 | 53 | } |
| 54 | 54 | $this->queue = Pheanstalk::create($config->host, $port); |
| 55 | 55 | $this->queue->useTube($this->tube); |
| 56 | - foreach ($this->subscriptions as $tube => $callback){ |
|
| 56 | + foreach ($this->subscriptions as $tube => $callback) { |
|
| 57 | 57 | $this->subscribe($tube, $callback); |
| 58 | 58 | } |
| 59 | 59 | $this->connected = true; |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | $this->queue->delete($job); |
| 105 | 105 | } |
| 106 | 106 | } catch (Throwable $exception) { |
| 107 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
| 107 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
| 108 | 108 | if ($job !== null) { |
| 109 | 109 | $this->queue->bury($job); |
| 110 | 110 | } |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | ): Job { |
| 137 | 137 | $tube = str_replace("\\", '-', $tube); |
| 138 | 138 | // Change tube |
| 139 | - if ( ! empty($tube) && $this->tube !== $tube) { |
|
| 139 | + if (!empty($tube) && $this->tube !== $tube) { |
|
| 140 | 140 | $this->queue->useTube($tube); |
| 141 | 141 | } |
| 142 | 142 | $job_data = serialize($job_data); |
@@ -161,10 +161,10 @@ discard block |
||
| 161 | 161 | $queueStats = $this->queue->stats()->getArrayCopy(); |
| 162 | 162 | |
| 163 | 163 | // Delete buried jobs |
| 164 | - $countBuried=$queueStats['current-jobs-buried']; |
|
| 164 | + $countBuried = $queueStats['current-jobs-buried']; |
|
| 165 | 165 | while ($job = $this->queue->peekBuried()) { |
| 166 | 166 | $countBuried--; |
| 167 | - if ($countBuried<0){ |
|
| 167 | + if ($countBuried < 0) { |
|
| 168 | 168 | break; |
| 169 | 169 | } |
| 170 | 170 | $id = $job->getId(); |
@@ -173,23 +173,23 @@ discard block |
||
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | // Delete outdated jobs |
| 176 | - $countReady=$queueStats['current-jobs-ready']; |
|
| 176 | + $countReady = $queueStats['current-jobs-ready']; |
|
| 177 | 177 | while ($job = $this->queue->peekReady()) { |
| 178 | 178 | $countReady--; |
| 179 | - if ($countReady<0){ |
|
| 179 | + if ($countReady < 0) { |
|
| 180 | 180 | break; |
| 181 | 181 | } |
| 182 | 182 | $id = $job->getId(); |
| 183 | 183 | $jobStats = $this->queue->statsJob($job)->getArrayCopy(); |
| 184 | - $age = (int)$jobStats['age']; |
|
| 185 | - $expectedTimeToExecute = (int)$jobStats['ttr'] * 2; |
|
| 184 | + $age = (int) $jobStats['age']; |
|
| 185 | + $expectedTimeToExecute = (int) $jobStats['ttr'] * 2; |
|
| 186 | 186 | if ($age > $expectedTimeToExecute) { |
| 187 | 187 | $this->queue->delete($job); |
| 188 | 188 | Util::sysLogMsg(__METHOD__, "Deleted outdated job with ID {$id} from {$tube}"); |
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | } catch (Throwable $exception) { |
| 192 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
| 192 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
| 193 | 193 | } |
| 194 | 194 | } |
| 195 | 195 | } |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | try { |
| 223 | 223 | $job = $this->queue->reserveWithTimeout($timeout); |
| 224 | 224 | } catch (Throwable $exception) { |
| 225 | - Util::sysLogMsg(__METHOD__, 'Exception: ' . $exception->getMessage()); |
|
| 225 | + Util::sysLogMsg(__METHOD__, 'Exception: '.$exception->getMessage()); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | if ($job === null) { |