diff --git a/src/Strategy/InterruptStrategy.php b/src/Strategy/InterruptStrategy.php index ac1cffb..b4e5fb9 100644 --- a/src/Strategy/InterruptStrategy.php +++ b/src/Strategy/InterruptStrategy.php @@ -21,7 +21,6 @@ public function __construct(array $options = null) // Conditional because of lack of pcntl_signal on windows if (function_exists('pcntl_signal')) { - declare(ticks = 1); pcntl_signal(SIGTERM, [$this, 'onPCNTLSignal']); pcntl_signal(SIGINT, [$this, 'onPCNTLSignal']); } @@ -57,6 +56,8 @@ public function attach(EventManagerInterface $events, $priority = 1) */ public function onStopConditionCheck(WorkerEvent $event) { + declare(ticks = 1); + if ($this->interrupted) { $event->exitWorkerLoop();