From e60aa1f9e8c2530c8eef6a0d028ee7239cd1fe11 Mon Sep 17 00:00:00 2001 From: mucha55 Date: Tue, 14 Jan 2020 09:56:18 -0600 Subject: [PATCH] KOJO-178 | Guard against full process pool when Root is polling singletons --- src/Process/Root.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Process/Root.php b/src/Process/Root.php index 41d65026..c5f08663 100644 --- a/src/Process/Root.php +++ b/src/Process/Root.php @@ -43,7 +43,9 @@ protected function pollSingletonProcesses() : Root if ($semaphoreResource->testLock()) { try { $process = $this->_getProcessCollection()->getProcessPrototypeClone($singletonType); - $this->_getProcessPool()->addChildProcess($process); + if (!$this->_getProcessPool()->isFull()) { + $this->_getProcessPool()->addChildProcess($process); + } } catch (Forked\Exception $forkedException) { // this is fine, another execution environment will spawn this process // TODO: consider breaking here to stop attempting to spawn other singletons