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

This commit is contained in:
humancopy 2011-10-23 09:47:33 +02:00
commit 599295ef9c
8 changed files with 34 additions and 10 deletions

View file

@ -63,7 +63,7 @@ class Resque_Job
$id = md5(uniqid('', true));
Resque::push($queue, array(
'class' => $class,
'args' => $args,
'args' => array($args),
'id' => $id,
));
@ -128,7 +128,7 @@ class Resque_Job
return array();
}
return $this->payload['args'];
return $this->payload['args'][0];
}
/**
@ -248,4 +248,4 @@ class Resque_Job
return '(' . implode(' | ', $name) . ')';
}
}
?>
?>

View file

@ -358,6 +358,7 @@ class Resque_Worker
pcntl_signal(SIGUSR1, array($this, 'killChild'));
pcntl_signal(SIGUSR2, array($this, 'pauseProcessing'));
pcntl_signal(SIGCONT, array($this, 'unPauseProcessing'));
pcntl_signal(SIGPIPE, array($this, 'reestablishRedisConnection'));
$this->log('Registered signals', self::LOG_VERBOSE);
}
@ -380,6 +381,16 @@ class Resque_Worker
$this->paused = false;
}
/**
* Signal handler for SIGPIPE, in the event the redis connection has gone away.
* Attempts to reconnect to redis, or raises an Exception.
*/
public function reestablishRedisConnection()
{
$this->log('SIGPIPE received; attempting to reconnect');
Resque::redis()->establishConnection();
}
/**
* Schedule a worker for shutdown. Will finish processing the current job
* and when the timeout interval is reached, the worker will shut down.