Send canonical deployments removal request only if all custom domains change
This commit is contained in:
parent
d75be96d70
commit
baaf0a2dd8
@ -251,8 +251,17 @@ export class Service {
|
||||
});
|
||||
|
||||
if (previousCanonicalDeployment) {
|
||||
// If all the DNS in the previous canonical deployment request are different from the new deployment request
|
||||
// Send removal request for the previous canonical deployment and delete DB entry
|
||||
if (previousCanonicalDeployment.url !== deployment.url) {
|
||||
const previousDnsList = previousCanonicalDeployment.applicationDeploymentRequestData?.dns || "";
|
||||
const newDnsList = deployment.applicationDeploymentRequestData?.dns || "";
|
||||
|
||||
const previousDnsSet = new Set(previousDnsList.split(",").map(item => item.trim()));
|
||||
const newDnsSet = new Set(newDnsList.split(",").map(item => item.trim()));
|
||||
|
||||
const isMatch = previousDnsSet.size === newDnsSet.size && [...previousDnsSet].every(item => newDnsSet.has(item));
|
||||
|
||||
if (!isMatch) {
|
||||
await this.laconicRegistry.createApplicationDeploymentRemovalRequest(
|
||||
{
|
||||
deploymentId:
|
||||
@ -676,6 +685,7 @@ export class Service {
|
||||
deployer: oldDeployment.deployer,
|
||||
});
|
||||
}
|
||||
|
||||
return newDeployment;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user