diff --git a/Classes/Controller/BackendServiceController.php b/Classes/Controller/BackendServiceController.php index 37b09703a7..3c5ae0694b 100644 --- a/Classes/Controller/BackendServiceController.php +++ b/Classes/Controller/BackendServiceController.php @@ -20,6 +20,7 @@ use Neos\ContentRepository\Core\Projection\ContentGraph\VisibilityConstraints; use Neos\ContentRepository\Core\SharedModel\Exception\NodeAggregateCurrentlyDoesNotExist; use Neos\ContentRepositoryRegistry\ContentRepositoryRegistry; +use Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\CatchUpTriggerWithSynchronousOption; use Neos\Eel\FlowQuery\FlowQuery; use Neos\Flow\Annotations as Flow; use Neos\Flow\Mvc\ActionRequest; @@ -235,12 +236,16 @@ public function publishAction(array $nodeContextPaths, string $targetWorkspaceNa ); } try { - $contentRepository->handle( - PublishIndividualNodesFromWorkspace::create( - $workspaceName, - NodeIdsToPublishOrDiscard::create(...$nodeIdentifiersToPublish) - ) - )->block(); + // performance speedup + CatchUpTriggerWithSynchronousOption::synchronously(fn() => + $contentRepository->handle( + PublishIndividualNodesFromWorkspace::create( + $workspaceName, + NodeIdsToPublishOrDiscard::create(...$nodeIdentifiersToPublish) + ) + )->block() + ); + } catch (NodeAggregateCurrentlyDoesNotExist $e) { throw new NodeAggregateCurrentlyDoesNotExist( 'Node could not be published, probably because of a missing parentNode. Please check that the parentNode has been published.', @@ -294,12 +299,16 @@ public function discardAction(array $nodeContextPaths): void $nodeAddress->dimensionSpacePoint ); } - $contentRepository->handle( - DiscardIndividualNodesFromWorkspace::create( - $workspaceName, - NodeIdsToPublishOrDiscard::create(...$nodeIdentifiersToDiscard) - ) - )->block(); + + // performance speedup + CatchUpTriggerWithSynchronousOption::synchronously(fn() => + $contentRepository->handle( + DiscardIndividualNodesFromWorkspace::create( + $workspaceName, + NodeIdsToPublishOrDiscard::create(...$nodeIdentifiersToDiscard) + ) + )->block() + ); $success = new Success(); $success->setMessage(sprintf('Discarded %d node(s).', count($nodeContextPaths))); diff --git a/Classes/Service/PublishingService.php b/Classes/Service/PublishingService.php index d00ca3f7f1..db24d82d34 100644 --- a/Classes/Service/PublishingService.php +++ b/Classes/Service/PublishingService.php @@ -18,6 +18,7 @@ use Neos\ContentRepository\Core\Feature\WorkspacePublication\Command\PublishWorkspace; use Neos\ContentRepository\Core\Feature\WorkspaceRebase\Command\RebaseWorkspace; use Neos\ContentRepository\Core\SharedModel\Workspace\WorkspaceName; +use Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\CatchUpTriggerWithSynchronousOption; use Neos\Flow\Annotations as Flow; /** @@ -31,16 +32,22 @@ class PublishingService public function publishWorkspace(ContentRepository $contentRepository, WorkspaceName $workspaceName): void { // TODO: only rebase if necessary! - $contentRepository->handle( - RebaseWorkspace::create( - $workspaceName - ) - )->block(); + // performance speedup + CatchUpTriggerWithSynchronousOption::synchronously(fn() => + $contentRepository->handle( + RebaseWorkspace::create( + $workspaceName + ) + )->block() + ); - $contentRepository->handle( - new PublishWorkspace( - $workspaceName - ) - )->block(); + // performance speedup + CatchUpTriggerWithSynchronousOption::synchronously(fn() => + $contentRepository->handle( + new PublishWorkspace( + $workspaceName + ) + )->block() + ); } }