Skip to content

Commit

Permalink
WIP: FEATURE: Rework CR CatchUp mechanism
Browse files Browse the repository at this point in the history
  • Loading branch information
bwaidelich committed Apr 11, 2024
1 parent 9ee2fc8 commit 1138434
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 113 deletions.

This file was deleted.

Expand Up @@ -33,43 +33,14 @@ class CatchUpTriggerWithSynchronousOption implements ProjectionCatchUpTriggerInt
*/
protected $contentRepositoryRegistry;

private static bool $synchronousEnabled = false;

/**
* INTERNAL
*/
public static function enableSynchronicityForSpeedingUpTesting(): void
{
self::$synchronousEnabled = true;
}

public static function synchronously(\Closure $fn): void
{
$previousValue = self::$synchronousEnabled;
self::$synchronousEnabled = true;
try {
$fn();
} finally {
self::$synchronousEnabled = $previousValue;
}
}

public function __construct(
private readonly ContentRepositoryId $contentRepositoryId,
private readonly SubprocessProjectionCatchUpTrigger $inner
) {
}

public function triggerCatchUp(Projections $projections): void
{
if (self::$synchronousEnabled) {
$contentRepository = $this->contentRepositoryRegistry->get($this->contentRepositoryId);
foreach ($projections as $projection) {
$projectionClassName = get_class($projection);
$contentRepository->catchUpProjection($projectionClassName, CatchUpOptions::create());
}
} else {
$this->inner->triggerCatchUp($projections);
}
$contentRepository = $this->contentRepositoryRegistry->get($this->contentRepositoryId);
$contentRepository->catchUpProjections();

Check failure on line 44 in Neos.ContentRepositoryRegistry/Classes/Factory/ProjectionCatchUpTrigger/DefaultCatchUpTrigger.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Call to an undefined method Neos\ContentRepository\Core\ContentRepository::catchUpProjections().

Check failure on line 44 in Neos.ContentRepositoryRegistry/Classes/Factory/ProjectionCatchUpTrigger/DefaultCatchUpTrigger.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Call to an undefined method Neos\ContentRepository\Core\ContentRepository::catchUpProjections().
}
}
Expand Up @@ -14,9 +14,8 @@ class SubprocessProjectionCatchUpTriggerFactory implements ProjectionCatchUpTrig
/** @param array<string, mixed> $options */
public function build(ContentRepositoryId $contentRepositoryId, array $options): ProjectionCatchUpTriggerInterface
{
return new CatchUpTriggerWithSynchronousOption(
return new DefaultCatchUpTrigger(

Check failure on line 17 in Neos.ContentRepositoryRegistry/Classes/Factory/ProjectionCatchUpTrigger/DefaultProjectionCatchUpTriggerFactory.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Instantiated class Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\DefaultCatchUpTrigger not found.

Check failure on line 17 in Neos.ContentRepositoryRegistry/Classes/Factory/ProjectionCatchUpTrigger/DefaultProjectionCatchUpTriggerFactory.php

View workflow job for this annotation

GitHub Actions / PHP 8.2 Test linting-unit-functionaltests-mysql (deps: highest)

Method Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\SubprocessProjectionCatchUpTriggerFactory::build() should return Neos\ContentRepository\Core\Projection\ProjectionCatchUpTriggerInterface but returns Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\DefaultCatchUpTrigger.

Check failure on line 17 in Neos.ContentRepositoryRegistry/Classes/Factory/ProjectionCatchUpTrigger/DefaultProjectionCatchUpTriggerFactory.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Instantiated class Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\DefaultCatchUpTrigger not found.

Check failure on line 17 in Neos.ContentRepositoryRegistry/Classes/Factory/ProjectionCatchUpTrigger/DefaultProjectionCatchUpTriggerFactory.php

View workflow job for this annotation

GitHub Actions / PHP 8.3 Test linting-unit-functionaltests-mysql (deps: highest)

Method Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\SubprocessProjectionCatchUpTriggerFactory::build() should return Neos\ContentRepository\Core\Projection\ProjectionCatchUpTriggerInterface but returns Neos\ContentRepositoryRegistry\Factory\ProjectionCatchUpTrigger\DefaultCatchUpTrigger.
$contentRepositoryId,
new SubprocessProjectionCatchUpTrigger($contentRepositoryId)
);
}
}

This file was deleted.

0 comments on commit 1138434

Please sign in to comment.