Skip to content

Commit

Permalink
TASK: Revert special code path from partial to full publish
Browse files Browse the repository at this point in the history
Reverts 05d6d5a partially

Initially this change was done to fix #5303
But that was a hoax see neos/neos-development-collection#5303 (comment)

we always emit the `WorkspaceWasPublished` event and this just simplifies the code-path again.

For the discard all case, the code is stil a little easier to read _with_ the condition.
  • Loading branch information
mhsdesign committed Dec 9, 2024
1 parent 6e9b3e7 commit e663f34
Showing 1 changed file with 2 additions and 34 deletions.
36 changes: 2 additions & 34 deletions Classes/Feature/WorkspaceCommandHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,26 +209,6 @@ private function handlePublishWorkspace(
$workspaceContentStreamVersion
);

yield from $this->publishWorkspace(
$workspace,
$baseWorkspace,
$baseWorkspaceContentStreamVersion,
$command->newContentStreamId,
$rebaseableCommands
);
}

/**
* Note that the workspaces content stream must be closed beforehand.
* It will be reopened here in case of error.
*/
private function publishWorkspace(
Workspace $workspace,
Workspace $baseWorkspace,
Version $baseWorkspaceContentStreamVersion,
ContentStreamId $newContentStreamId,
RebaseableCommands $rebaseableCommands
): \Generator {
$commandSimulator = $this->commandSimulatorFactory->createSimulatorForWorkspace($baseWorkspace->workspaceName);

$commandSimulator->run(
Expand Down Expand Up @@ -267,7 +247,7 @@ static function ($handle) use ($rebaseableCommands): void {
}

yield $this->forkContentStream(
$newContentStreamId,
$command->newContentStreamId,
$baseWorkspace->currentContentStreamId,
Version::fromInteger($baseWorkspaceContentStreamVersion->value + $eventsOfWorkspaceToPublish->count())
);
Expand All @@ -278,7 +258,7 @@ static function ($handle) use ($rebaseableCommands): void {
new WorkspaceWasPublished(
$workspace->workspaceName,
$baseWorkspace->workspaceName,
$newContentStreamId,
$command->newContentStreamId,
$workspace->currentContentStreamId,
)
),
Expand Down Expand Up @@ -475,18 +455,6 @@ private function handlePublishIndividualNodesFromWorkspace(
$workspaceContentStreamVersion
);

if ($remainingCommands->isEmpty()) {
// do a full publish, this is simpler for the projections to handle
yield from $this->publishWorkspace(
$workspace,
$baseWorkspace,
$baseWorkspaceContentStreamVersion,
$command->contentStreamIdForRemainingPart,
$matchingCommands
);
return;
}

$commandSimulator = $this->commandSimulatorFactory->createSimulatorForWorkspace($baseWorkspace->workspaceName);

$highestSequenceNumberForMatching = $commandSimulator->run(
Expand Down

0 comments on commit e663f34

Please sign in to comment.