Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions src/Subscription/Engine/DefaultSubscriptionEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,7 @@
}

if ($subscription->hasCleanupTasks()) {
$error = $this->cleanup($subscription);
$error = $this->cleanup($subscription, true);

if ($error) {
$errors[] = $error;
Expand Down Expand Up @@ -1319,7 +1319,7 @@
return $this->retryStrategyRepository->get($retryStrategy);
}

private function cleanup(Subscription $subscription): Error|null
private function cleanup(Subscription $subscription, bool $force = false): Error|null
{
if (!$this->cleaner) {
throw new CleanerNotConfigured();
Expand All @@ -1342,6 +1342,15 @@
),
);

if ($force) {
$this->subscriptionManager->remove($subscription);

$this->logger?->info(sprintf(

Check warning on line 1348 in src/Subscription/Engine/DefaultSubscriptionEngine.php

View workflow job for this annotation

GitHub Actions / Mutation tests on diff (locked, 8.5, ubuntu-latest)

Escaped Mutant for Mutator "MethodCallRemoval": @@ @@ if ($force) { $this->subscriptionManager->remove($subscription); - $this->logger?->info(sprintf( - 'Subscription Engine: Subscription "%s" removed.', - $subscription->id(), - )); + } return new Error(
'Subscription Engine: Subscription "%s" removed.',
$subscription->id(),
));
}

return new Error(
$subscription->id(),
$e->getMessage(),
Expand Down
20 changes: 10 additions & 10 deletions tests/Unit/Subscription/Engine/DefaultSubscriptionEngineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3785,15 +3785,15 @@ public function testRemoveWithCleanupHandlerError(): void

$task = new DropTableTask('test');

$subscriptionStore = new DummySubscriptionStore([
new Subscription(
$subscriptionId,
Subscription::DEFAULT_GROUP,
RunMode::FromBeginning,
Status::Detached,
cleanupTasks: [$task],
),
]);
$subscription = new Subscription(
$subscriptionId,
Subscription::DEFAULT_GROUP,
RunMode::FromBeginning,
Status::Detached,
cleanupTasks: [$task],
);

$subscriptionStore = new DummySubscriptionStore([$subscription]);

$streamableStore = $this->createMock(Store::class);

Expand All @@ -3818,7 +3818,7 @@ public function testRemoveWithCleanupHandlerError(): void
self::assertEquals($subscriptionId, $error->subscriptionId);
self::assertInstanceOf(CleanupFailed::class, $error->throwable);

$subscriptionStore->assertNoChanges();
$subscriptionStore->assertRemoved($subscription);
}

public function testReactiveDiscoverNewSubscribers(): void
Expand Down
Loading