mirror of
https://github.com/appwrite/appwrite
synced 2026-05-23 00:49:02 +00:00
Don't auto-activate deployment which started earlier & ended later than active deployment
This commit is contained in:
parent
c92a14d318
commit
7a465dc8f8
1 changed files with 15 additions and 0 deletions
|
|
@ -1072,6 +1072,21 @@ class Builds extends Action
|
|||
|
||||
/** Set auto deploy */
|
||||
if ($deployment->getAttribute('activate') === true) {
|
||||
// Check if current active deployment started later than this deployment
|
||||
$currentDeploymentId = $resource->getAttribute('deploymentId', '');
|
||||
if (!empty($currentDeploymentId)) {
|
||||
$currentDeployment = $dbForProject->getDocument('deployments', $currentDeploymentId);
|
||||
if (!$currentDeployment->isEmpty()) {
|
||||
$currentStartTime = $currentDeployment->getAttribute('buildStartedAt', '');
|
||||
$newStartTime = $deployment->getAttribute('buildStartedAt', '');
|
||||
|
||||
if (!empty($currentStartTime) && !empty($newStartTime) && $currentStartTime > $newStartTime) {
|
||||
Console::info('Skipping auto-activation as current deployment started later');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$resource->setAttribute('live', true);
|
||||
switch ($resource->getCollection()) {
|
||||
case 'functions':
|
||||
|
|
|
|||
Loading…
Reference in a new issue