This commit is contained in:
Chaitanya Kuber 2012-03-06 22:48:01 -06:00
commit 48a7febd88
5 changed files with 70 additions and 21 deletions

View file

@ -39,7 +39,7 @@ class Resque_Redis extends Redisent
'setnx',
'incr',
'incrby',
'decrby',
'decr',
'decrby',
'rpush',
'lpush',

View file

@ -96,7 +96,7 @@ class Resque_Worker
*/
public static function find($workerId)
{
if(!self::exists($workerId)) {
if(!self::exists($workerId) || false === strpos($workerId, ":")) {
return false;
}
@ -449,12 +449,14 @@ class Resque_Worker
$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();
}
}
}