mirror of
https://github.com/idanoo/php-resque
synced 2025-07-01 05:32:20 +00:00
Merge branch 'master' of git://github.com/chrisboulton/php-resque
This commit is contained in:
commit
599295ef9c
8 changed files with 34 additions and 10 deletions
|
@ -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) . ')';
|
||||
}
|
||||
}
|
||||
?>
|
||||
?>
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue