Permalink
Browse files

Merge branch 'master' of github.com:chrisboulton/php-resque

  • Loading branch information...
2 parents 0ad5903 + 37e148b commit 6651f957f1fdd8c2ab96dccb4da607be6f5320bf Chris Boulton committed Mar 5, 2012
Showing with 10 additions and 8 deletions.
  1. +10 −8 lib/Resque/Worker.php
View
@@ -53,7 +53,7 @@ class Resque_Worker
* @var Resque_Job Current job, if any, being processed by this worker.
*/
private $currentJob = null;
-
+
/**
* @var int Process ID of child worker processes.
*/
@@ -95,7 +95,7 @@ public static function exists($workerId)
*/
public static function find($workerId)
{
- if(!self::exists($workerId)) {
+ if(!self::exists($workerId) || false === strpos($workerId, ":")) {
return false;
}
@@ -447,12 +447,14 @@ public function pruneDeadWorkers()
$workerPids = $this->workerPids();
$workers = self::all();
foreach($workers as $worker) {
- list($host, $pid, $queues) = explode(':', (string)$worker, 3);
- if($host != $this->hostname || in_array($pid, $workerPids) || $pid == getmypid()) {
- continue;
- }
- $this->log('Pruning dead worker: ' . (string)$worker, self::LOG_VERBOSE);
- $worker->unregisterWorker();
+ if (is_object($worker)) {
+ list($host, $pid, $queues) = explode(':', (string)$worker, 3);
+ if($host != $this->hostname || in_array($pid, $workerPids) || $pid == getmypid()) {
+ continue;
+ }
+ $this->log('Pruning dead worker: ' . (string)$worker, self::LOG_VERBOSE);
+ $worker->unregisterWorker();
+ }
}
}

0 comments on commit 6651f95

Please sign in to comment.