Skip to content

Commit 8e20be9

Browse files
committed
BUGFIX: Speed up enumeration by fetching all documents with one query
Each document needs to be checked whether it’s still connected to the page tree though.
1 parent a15d22e commit 8e20be9

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

Classes/NodeEnumeration/NodeEnumerator.php

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313
use Flowpack\DecoupledContentStore\NodeRendering\Dto\NodeRenderingCompletionStatus;
1414
use Flowpack\DecoupledContentStore\PrepareContentRelease\Infrastructure\RedisContentReleaseService;
1515
use Flowpack\DecoupledContentStore\Utility\GeneratorUtility;
16+
use Neos\ContentRepository\Domain\Model\NodeInterface;
1617
use Neos\ContentRepository\Domain\NodeType\NodeTypeConstraintFactory;
1718
use Neos\ContentRepository\Domain\NodeType\NodeTypeName;
19+
use Neos\ContentRepository\Domain\Utility\NodePaths;
20+
use Neos\Eel\FlowQuery\FlowQuery;
1821
use Neos\Flow\Annotations as Flow;
1922
use Neos\Neos\Domain\Model\Site;
2023

@@ -91,10 +94,31 @@ private function enumerateAll(?Site $site, ContentReleaseLogger $contentReleaseL
9194
'dimensionValues' => $dimensionValues
9295
]);
9396

94-
foreach ($combinator->recurseDocumentChildNodes($siteNode) as $documentNode) {
97+
$documentQuery = new FlowQuery([$siteNode]);
98+
/** @var NodeInterface[] $documents */
99+
$documents = $documentQuery->find('[instanceof Neos.Neos:Document]')->add($siteNode)->get();
100+
101+
foreach ($documents as $documentNode) {
95102
$contextPath = $documentNode->getContextPath();
96103

97-
if ($documentNode->isHidden()) {
104+
// Verify that the node is not orphaned
105+
$parentNode = $documentNode->getParent();
106+
while ($parentNode !== $siteNode) {
107+
if ($parentNode === null) {
108+
$contentReleaseLogger->debug('Skipping node from publishing, because it is orphaned', [
109+
'node' => $contextPath,
110+
]);
111+
// Continue with the next document
112+
continue 2;
113+
}
114+
$parentNode = $parentNode->getParent();
115+
}
116+
117+
if (!$documentNode->getParent()) {
118+
$contentReleaseLogger->debug('Skipping node from publishing, because it is orphaned', [
119+
'node' => $contextPath,
120+
]);
121+
} else if ($documentNode->isHidden()) {
98122
$contentReleaseLogger->debug('Skipping node from publishing, because it is hidden', [
99123
'node' => $contextPath,
100124
]);

0 commit comments

Comments
 (0)