Move declare(ticks = 1) to startup

Having declare(ticks = 1) inside registerSigHandlers() worked perfectly on PHP 5.6 but it doesn't on PHP 7.

I found it that moving the declare(ticks = 1) outside registerSigHandlers() solves the issue.
This commit is contained in:
Ruud Kamphuis 2016-08-03 17:07:52 +02:00 committed by GitHub
parent ab07fda51c
commit 16f88a6a38

View File

@ -311,6 +311,8 @@ class Resque_Worker
*/
private function startup()
{
declare(ticks = 1);
$this->registerSigHandlers();
$this->pruneDeadWorkers();
Resque_Event::trigger('beforeFirstFork', $this);
@ -349,7 +351,6 @@ class Resque_Worker
return;
}
declare(ticks = 1);
pcntl_signal(SIGTERM, array($this, 'shutDownNow'));
pcntl_signal(SIGINT, array($this, 'shutDownNow'));
pcntl_signal(SIGQUIT, array($this, 'shutdown'));