@@ -227,8 +227,7 @@ |
||
227 | 227 | ); |
228 | 228 | try { |
229 | 229 | Resque_Event::trigger('beforeEnqueue', $hookParams); |
230 | - } |
|
231 | - catch(Resque_Job_DontCreate $e) { |
|
230 | + } catch(Resque_Job_DontCreate $e) { |
|
232 | 231 | return false; |
233 | 232 | } |
234 | 233 |
@@ -212,8 +212,7 @@ discard block |
||
212 | 212 | $this->logger->log(Psr\Log\LogLevel::INFO, 'Sleeping for {interval}', array('interval' => $interval)); |
213 | 213 | if($this->paused) { |
214 | 214 | $this->updateProcLine('Paused'); |
215 | - } |
|
216 | - else { |
|
215 | + } else { |
|
217 | 216 | $this->updateProcLine('Waiting'); |
218 | 217 | } |
219 | 218 | |
@@ -272,8 +271,7 @@ discard block |
||
272 | 271 | $job->fail(new Resque_Job_DirtyExitException( |
273 | 272 | 'Job exited with exit code ' . $exitStatus |
274 | 273 | )); |
275 | - } |
|
276 | - else |
|
274 | + } else |
|
277 | 275 | { |
278 | 276 | if (in_array($job->getStatus(), array(Resque_Job_Status::STATUS_WAITING, Resque_Job_Status::STATUS_RUNNING))) |
279 | 277 | { |
@@ -301,13 +299,11 @@ discard block |
||
301 | 299 | try { |
302 | 300 | Resque_Event::trigger('afterFork', $job); |
303 | 301 | $result = $job->perform(); |
304 | - } |
|
305 | - catch(Exception $e) { |
|
302 | + } catch(Exception $e) { |
|
306 | 303 | $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {exception}', array('job' => $job, 'exception' => $e)); |
307 | 304 | $job->fail($e); |
308 | 305 | return; |
309 | - } |
|
310 | - catch(Error $e) { |
|
306 | + } catch(Error $e) { |
|
311 | 307 | $this->logger->log(Psr\Log\LogLevel::CRITICAL, '{job} has failed {exception}', array('job' => $job, 'exception' => $e)); |
312 | 308 | $job->fail($e); |
313 | 309 | return; |
@@ -405,8 +401,7 @@ discard block |
||
405 | 401 | $processTitle = static::$processPrefix . '-' . Resque::VERSION . ' (' . implode(',', $this->queues) . '): ' . $status; |
406 | 402 | if(function_exists('cli_set_process_title') && PHP_OS !== 'Darwin') { |
407 | 403 | cli_set_process_title($processTitle); |
408 | - } |
|
409 | - else if(function_exists('setproctitle')) { |
|
404 | + } else if(function_exists('setproctitle')) { |
|
410 | 405 | setproctitle($processTitle); |
411 | 406 | } |
412 | 407 | } |
@@ -496,8 +491,7 @@ discard block |
||
496 | 491 | $this->logger->log(Psr\Log\LogLevel::DEBUG, 'Child {child} found, killing.', array('child' => $this->child)); |
497 | 492 | posix_kill($this->child, SIGKILL); |
498 | 493 | $this->child = null; |
499 | - } |
|
500 | - else { |
|
494 | + } else { |
|
501 | 495 | $this->logger->log(Psr\Log\LogLevel::INFO, 'Child {child} not found, restarting.', array('child' => $this->child)); |
502 | 496 | $this->shutdown(); |
503 | 497 | } |
@@ -542,8 +536,7 @@ discard block |
||
542 | 536 | $line = preg_replace('/\s+/m', ' ', $line); |
543 | 537 | list(,,$pids[]) = explode(' ', trim($line), 3); |
544 | 538 | } |
545 | - } |
|
546 | - else { |
|
539 | + } else { |
|
547 | 540 | exec('ps -A -o pid,args | grep [r]esque', $cmdOutput); |
548 | 541 | foreach($cmdOutput as $line) { |
549 | 542 | list($pids[],) = explode(' ', trim($line), 2); |
@@ -628,8 +621,7 @@ discard block |
||
628 | 621 | $job = Resque::redis()->get('worker:' . $this); |
629 | 622 | if(!$job) { |
630 | 623 | return array(); |
631 | - } |
|
632 | - else { |
|
624 | + } else { |
|
633 | 625 | return json_decode($job, true); |
634 | 626 | } |
635 | 627 | } |
@@ -115,14 +115,11 @@ discard block |
||
115 | 115 | try { |
116 | 116 | if (is_object($client)) { |
117 | 117 | $this->driver = $client; |
118 | - } |
|
119 | - elseif (is_object($server)) { |
|
118 | + } elseif (is_object($server)) { |
|
120 | 119 | $this->driver = $server; |
121 | - } |
|
122 | - elseif (is_array($server)) { |
|
120 | + } elseif (is_array($server)) { |
|
123 | 121 | $this->driver = new Credis_Cluster($server); |
124 | - } |
|
125 | - else { |
|
122 | + } else { |
|
126 | 123 | list($host, $port, $dsnDatabase, $user, $password, $options) = self::parseDsn($server); |
127 | 124 | // $user is not used, only $password |
128 | 125 | |
@@ -147,8 +144,7 @@ discard block |
||
147 | 144 | if ($database !== null) { |
148 | 145 | $this->driver->select($database); |
149 | 146 | } |
150 | - } |
|
151 | - catch(CredisException $e) { |
|
147 | + } catch(CredisException $e) { |
|
152 | 148 | throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); |
153 | 149 | } |
154 | 150 | } |
@@ -243,15 +239,13 @@ discard block |
||
243 | 239 | foreach ($args[0] AS $i => $v) { |
244 | 240 | $args[0][$i] = self::$defaultNamespace . $v; |
245 | 241 | } |
246 | - } |
|
247 | - else { |
|
242 | + } else { |
|
248 | 243 | $args[0] = self::$defaultNamespace . $args[0]; |
249 | 244 | } |
250 | 245 | } |
251 | 246 | try { |
252 | 247 | return $this->driver->__call($name, $args); |
253 | - } |
|
254 | - catch (CredisException $e) { |
|
248 | + } catch (CredisException $e) { |
|
255 | 249 | throw new Resque_RedisException('Error communicating with Redis: ' . $e->getMessage(), 0, $e); |
256 | 250 | } |
257 | 251 | } |
@@ -220,8 +220,7 @@ discard block |
||
220 | 220 | { |
221 | 221 | if ($at === null) { |
222 | 222 | $at = time(); |
223 | - } |
|
224 | - else { |
|
223 | + } else { |
|
225 | 224 | $at = self::getTimestamp($at); |
226 | 225 | } |
227 | 226 | |
@@ -261,8 +260,7 @@ discard block |
||
261 | 260 | { |
262 | 261 | if (empty($class)) { |
263 | 262 | throw new Resque_Exception('Jobs must be given a class.'); |
264 | - } |
|
265 | - else if (empty($queue)) { |
|
263 | + } else if (empty($queue)) { |
|
266 | 264 | throw new Resque_Exception('Jobs must be put in a queue.'); |
267 | 265 | } |
268 | 266 |
@@ -119,8 +119,7 @@ |
||
119 | 119 | { |
120 | 120 | if($this->logLevel == self::LOG_NORMAL) { |
121 | 121 | fwrite(STDOUT, "*** " . $message . "\n"); |
122 | - } |
|
123 | - else if($this->logLevel == self::LOG_VERBOSE) { |
|
122 | + } else if($this->logLevel == self::LOG_VERBOSE) { |
|
124 | 123 | fwrite(STDOUT, "** [" . strftime('%T %Y-%m-%d') . "] " . $message . "\n"); |
125 | 124 | } |
126 | 125 | } |