From 76568ac021abd442aa7ad53eff7dfbb7e468ee29 Mon Sep 17 00:00:00 2001 From: Mojmir Fendek Date: Thu, 19 Oct 2023 13:42:03 +1300 Subject: [PATCH] PR fixes. --- src/RecursiveStagesService.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/RecursiveStagesService.php b/src/RecursiveStagesService.php index 1889d0cb..e125c8ca 100644 --- a/src/RecursiveStagesService.php +++ b/src/RecursiveStagesService.php @@ -127,6 +127,7 @@ protected function getOwnedIdentifiers(DataObject $object, string $stage): array */ protected function getOwnedObjects(DataObject $object): array { + /** @var DataObject|Versioned $object */ if (!$object->hasExtension(RecursivePublishable::class)) { return []; } @@ -137,8 +138,10 @@ protected function getOwnedObjects(DataObject $object): array if (!array_key_exists($cacheKey, $this->ownedObjectsCache)) { $this->ownedObjectsCache[$cacheKey] = $object - // We intentionally avoid recursive traversal here as it's not memory efficient, - // stack based approach is used instead for better performance + // We intentionally avoid "true" recursive traversal here as it's not performant + // (often the cause of memory usage spikes and longer exeuction time due to deeper stack depth) + // Instead we use "stack based" recursive traversal approach for better performance + // which avoids the nested method calls ->findOwned(false) ->toArray(); }