Skip to content

Commit

Permalink
TASK: Introduce test that we cannot roll-back setup
Browse files Browse the repository at this point in the history
Similarly to that doctrine migrations (`flow doctrine:migrate`) are also cannot be rollback in case of an error

So we cannot wrap projection->setUp in transaction and errors (like in a migration) will be directly commited. Thus, it must be acted with care.
  • Loading branch information
mhsdesign committed Dec 10, 2024
1 parent 816c145 commit f9a03a2
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions Classes/Subscription/Engine/SubscriptionEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function setup(SubscriptionEngineCriteria|null $criteria = null): Result
SubscriptionStatus::ACTIVE
])));
if ($subscriptions->isEmpty()) {
$this->logger?->info('Subscription Engine: No subscriptions found.'); // todo not happy? Because there must be at least the content graph?!!
// should not happen as this means the contentGraph is unavailable, see status information.
$this->logger?->info('Subscription Engine: No subscriptions found.');
return Result::success();
}
$errors = [];
Expand Down Expand Up @@ -211,7 +212,6 @@ private function setupSubscription(Subscription $subscription): ?Error
try {
$subscriber->projection->setUp();
} catch (\Throwable $e) {
// todo wrap in savepoint to ensure error do not mess up the projection?
$this->logger?->error(sprintf('Subscription Engine: Subscriber "%s" for "%s" has an error in the setup method: %s', $subscriber::class, $subscription->id->value, $e->getMessage()));
$this->subscriptionStore->update(
$subscription->id,
Expand Down

0 comments on commit f9a03a2

Please sign in to comment.