@kumori/aurora-backend-handler 1.1.66 → 1.1.68
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
initializeGlobalWebSocketClient,
|
|
6
6
|
getWebSocketStatus,
|
|
7
7
|
makeGlobalWebSocketRequest,
|
|
8
|
+
markEnvironmentAsPurging,
|
|
8
9
|
} from "../websocket-manager";
|
|
9
10
|
|
|
10
11
|
type Security = string;
|
|
@@ -259,6 +260,10 @@ export const clearEnvironment = async (
|
|
|
259
260
|
}
|
|
260
261
|
};
|
|
261
262
|
eventHelper.notification.publish.creation(envNotification);
|
|
263
|
+
const purgeKey = env.tenant && env.account
|
|
264
|
+
? `${env.tenant}/${env.account}/${env.name}`
|
|
265
|
+
: env.name;
|
|
266
|
+
markEnvironmentAsPurging(purgeKey);
|
|
262
267
|
await initializeGlobalWebSocketClient(security, "environment", env.name);
|
|
263
268
|
const status = getWebSocketStatus();
|
|
264
269
|
|
|
@@ -80,17 +80,18 @@ export const handleEnvironmentEvent = ({
|
|
|
80
80
|
logo: "",
|
|
81
81
|
services: [],
|
|
82
82
|
domains: [],
|
|
83
|
-
status:
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
83
|
+
status: (() => {
|
|
84
|
+
const existingCode = existingEnvironment?.status?.code;
|
|
85
|
+
const isPurging = existingCode === "PURGING" || existingCode === "CLEANING_ENVIRONMENT";
|
|
86
|
+
const eventCode = eventData.meta?.deleted ? "DELETING" : eventData.status?.state?.code;
|
|
87
|
+
if (isPurging && typeof eventCode === "string" && eventCode.startsWith("DELETING")) {
|
|
88
|
+
return { code: "PURGING", message: `Environment ${entityId} is being purged.`, timestamp: new Date().toISOString() };
|
|
89
|
+
}
|
|
90
|
+
if (eventData.meta?.deleted) {
|
|
91
|
+
return { code: "DELETING", message: `Environment ${entityId} is being deleted.`, timestamp: new Date().toISOString() };
|
|
92
|
+
}
|
|
93
|
+
return { code: eventData.status.state.code, message: eventData.status.state.message, timestamp: eventData.status.state.timestamp };
|
|
94
|
+
})(),
|
|
94
95
|
highAvaliable: eventData.spec.highlyAvailable || false,
|
|
95
96
|
usage: {
|
|
96
97
|
current: {
|
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -545,6 +545,23 @@ export const makeGlobalWebSocketRequestWithRetry = async (
|
|
|
545
545
|
);
|
|
546
546
|
};
|
|
547
547
|
|
|
548
|
+
export const markEnvironmentAsPurging = (envKey: string) => {
|
|
549
|
+
purgingEnvironments.add(envKey);
|
|
550
|
+
const env = environmentsMap.get(envKey);
|
|
551
|
+
if (env) {
|
|
552
|
+
const updatedEnv: Environment = {
|
|
553
|
+
...env,
|
|
554
|
+
status: {
|
|
555
|
+
code: "PURGING",
|
|
556
|
+
message: `Environment ${env.name} is being purged.`,
|
|
557
|
+
timestamp: new Date().toISOString(),
|
|
558
|
+
},
|
|
559
|
+
};
|
|
560
|
+
environmentsMap.set(envKey, updatedEnv);
|
|
561
|
+
eventHelper.environment.publish.updated(updatedEnv);
|
|
562
|
+
}
|
|
563
|
+
};
|
|
564
|
+
|
|
548
565
|
/**
|
|
549
566
|
* Get the current WebSocket connection status
|
|
550
567
|
* @returns Connection status and token info
|
|
@@ -695,7 +712,7 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
695
712
|
}
|
|
696
713
|
const envSetKey = parentParts.tenant && parentParts.account ? `${parentParts.tenant}/${parentParts.account}/${entityId}` : entityId;
|
|
697
714
|
let envToStore = envEventResult.environment;
|
|
698
|
-
if (envToStore.status?.code
|
|
715
|
+
if (envToStore.status?.code?.startsWith("DELETING") && purgingEnvironments.has(envSetKey)) {
|
|
699
716
|
envToStore = {
|
|
700
717
|
...envToStore,
|
|
701
718
|
status: {
|