Skip to content

Commit

Permalink
TASK: add exit if concurrent build lock is empty (should only happen …
Browse files Browse the repository at this point in the history
…if job config is wrong)
  • Loading branch information
batabana committed Feb 14, 2022
1 parent 549a343 commit 24ac8c7
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Classes/Core/ConcurrentBuildLockService.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,21 @@ public function ensureAllOtherInProgressContentReleasesWillBeTerminated(ContentR

public function assertNoOtherContentReleaseWasStarted(ContentReleaseIdentifier $contentReleaseIdentifier)
{
$concurrentBuildLock = ContentReleaseIdentifier::fromString($this->redisClientManager->getPrimaryRedis()->get('contentStore:concurrentBuildLock'));
$concurrentBuildLockString = $this->redisClientManager->getPrimaryRedis()->get('contentStore:concurrentBuildLock');

if (empty($concurrentBuildLockString)) {
echo '!!!!! Hard-aborting the current job ' . $contentReleaseIdentifier->getIdentifier() . ' because the concurrentBuildLock does not exist.' . "\n\n";
echo "This should never happen for correctly configured jobs (that run after prepare_finished).\n\n";
exit(1);
}

$concurrentBuildLock = ContentReleaseIdentifier::fromString($concurrentBuildLockString);

if (!$contentReleaseIdentifier->equals($concurrentBuildLock)) {
// the concurrent build lock is different (i.e. newer) than our currently-running content release.
// Thus, we abort the in-progress content release as quickly as we can - by DYING.

echo '!!!!! Hard-aborting the current job ' . $concurrentBuildLock->getIdentifier() . ' because the concurrentBuildLock contains ' . $concurrentBuildLock->getIdentifier() . "\n\n";
echo '!!!!! Hard-aborting the current job ' . $contentReleaseIdentifier->getIdentifier() . ' because the concurrentBuildLock contains ' . $concurrentBuildLock->getIdentifier() . "\n\n";
echo "This is no error during deployment, but should never happen outside a deployment.\n\n It can only happen if two prunner instances run concurrently.\n\n";
exit(1);
}
Expand Down

0 comments on commit 24ac8c7

Please sign in to comment.