Skip to content

Commit 24ac8c7

Browse files
committed
TASK: add exit if concurrent build lock is empty (should only happen if job config is wrong)
1 parent 549a343 commit 24ac8c7

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

Classes/Core/ConcurrentBuildLockService.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,21 @@ public function ensureAllOtherInProgressContentReleasesWillBeTerminated(ContentR
4141

4242
public function assertNoOtherContentReleaseWasStarted(ContentReleaseIdentifier $contentReleaseIdentifier)
4343
{
44-
$concurrentBuildLock = ContentReleaseIdentifier::fromString($this->redisClientManager->getPrimaryRedis()->get('contentStore:concurrentBuildLock'));
44+
$concurrentBuildLockString = $this->redisClientManager->getPrimaryRedis()->get('contentStore:concurrentBuildLock');
45+
46+
if (empty($concurrentBuildLockString)) {
47+
echo '!!!!! Hard-aborting the current job ' . $contentReleaseIdentifier->getIdentifier() . ' because the concurrentBuildLock does not exist.' . "\n\n";
48+
echo "This should never happen for correctly configured jobs (that run after prepare_finished).\n\n";
49+
exit(1);
50+
}
51+
52+
$concurrentBuildLock = ContentReleaseIdentifier::fromString($concurrentBuildLockString);
4553

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

50-
echo '!!!!! Hard-aborting the current job ' . $concurrentBuildLock->getIdentifier() . ' because the concurrentBuildLock contains ' . $concurrentBuildLock->getIdentifier() . "\n\n";
58+
echo '!!!!! Hard-aborting the current job ' . $contentReleaseIdentifier->getIdentifier() . ' because the concurrentBuildLock contains ' . $concurrentBuildLock->getIdentifier() . "\n\n";
5159
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";
5260
exit(1);
5361
}

0 commit comments

Comments
 (0)