Skip to content

Commit bd36262

Browse files
committed
TASK: only count successful releases for retention count
1 parent cf3a16f commit bd36262

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

Classes/Transfer/ContentReleaseCleaner.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
use Flowpack\DecoupledContentStore\Core\Infrastructure\ContentReleaseLogger;
99
use Flowpack\DecoupledContentStore\Core\Infrastructure\RedisClientManager;
1010
use Flowpack\DecoupledContentStore\Core\RedisKeyService;
11+
use Flowpack\DecoupledContentStore\NodeRendering\Dto\NodeRenderingCompletionStatus;
12+
use Flowpack\DecoupledContentStore\NodeRendering\Infrastructure\RedisRenderingErrorManager;
1113
use Flowpack\DecoupledContentStore\PrepareContentRelease\Infrastructure\RedisContentReleaseService;
1214
use Flowpack\DecoupledContentStore\ReleaseSwitch\Infrastructure\RedisReleaseSwitchService;
1315
use Flowpack\DecoupledContentStore\Transfer\Dto\RedisKeyPostfixesForEachRelease;
@@ -42,6 +44,11 @@ class ContentReleaseCleaner
4244
*/
4345
protected $redisReleaseSwitchService;
4446

47+
/**
48+
* @Flow\Inject
49+
* @var RedisRenderingErrorManager
50+
*/
51+
protected $redisRenderingErrorManager;
4552

4653
/**
4754
* @Flow\Inject
@@ -74,7 +81,10 @@ public function removeOldReleases(RedisInstanceIdentifier $redisInstanceIdentifi
7481
} elseif ($id->equals($contentReleaseIdentifierOfUpcomingRelease)) {
7582
$contentReleaseLogger->info('- ' . $id->getIdentifier() . ' (UPCOMING)');
7683
} else {
77-
$i++;
84+
// on primary: only add to counter if status of release is "success" and release has no errors
85+
if (!$redisInstanceIdentifier->isPrimary() || ($this->redisContentReleaseService->fetchMetadataForContentRelease($id)->getStatus()->getStatus() === NodeRenderingCompletionStatus::success()->getStatus() && count($this->redisRenderingErrorManager->getRenderingErrors($id)) === 0)) {
86+
$i++;
87+
}
7888

7989
// we always want to keep $currentRelease and $contentReleaseIdentifierOfUpcomingRelease; thus
8090
// we need to remove 2 from $contentReleasesToKeep

0 commit comments

Comments
 (0)