mirror of
https://github.com/appwrite/appwrite.git
synced 2026-11-18 20:36:03 +00:00
Don't auto-activate deployment which started earlier & ended later than active deployment
This commit is contained in:
1 parent
c92a14d318
commit
7a465dc8f8
1 file changed
+15
@@ -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':
|
||||
|
||||
Reference in new issue
Block a user