@kumori/aurora-backend-handler 1.1.50 → 1.1.51
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.
- package/helpers/revision-helper.ts +16 -15
- package/package.json +1 -1
|
@@ -179,17 +179,20 @@ const getContainerError = (
|
|
|
179
179
|
};
|
|
180
180
|
|
|
181
181
|
const handleRevisionStatus = (revisionStatus: any) => {
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
182
|
+
for (const roleData of Object.values<any>(revisionStatus.runtime.roles)) {
|
|
183
|
+
for (const instanceData of Object.values<any>(roleData.instances)) {
|
|
184
|
+
for (const container of Object.values<any>(instanceData.containers ?? {})) {
|
|
185
|
+
if (!container.status.ready) {
|
|
186
|
+
return {
|
|
187
|
+
code: container.status.status.waiting?.reason ?? "ContainerNotReady",
|
|
188
|
+
message: container.status.status.waiting?.message ?? "One or more containers are not ready for unknown reasons.",
|
|
189
|
+
timestamp: Date.now().toString(),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
188
194
|
}
|
|
189
195
|
|
|
190
|
-
const containerError = getContainerError(revisionStatus);
|
|
191
|
-
if (containerError) return containerError;
|
|
192
|
-
|
|
193
196
|
return revisionStatus?.state;
|
|
194
197
|
};
|
|
195
198
|
|
|
@@ -199,9 +202,7 @@ const createRevision = (
|
|
|
199
202
|
usedCpu: number,
|
|
200
203
|
usedMemory: number,
|
|
201
204
|
): Revision => {
|
|
202
|
-
const
|
|
203
|
-
const explicitError = eventData.status?.error;
|
|
204
|
-
const containerError = !explicitError ? getContainerError(eventData.status) : null;
|
|
205
|
+
const containerError = eventData.status?.error ? null : getContainerError(eventData.status);
|
|
205
206
|
|
|
206
207
|
return {
|
|
207
208
|
id: entityId,
|
|
@@ -237,9 +238,9 @@ const createRevision = (
|
|
|
237
238
|
},
|
|
238
239
|
cost: 0,
|
|
239
240
|
},
|
|
240
|
-
status,
|
|
241
|
-
errorCode:
|
|
242
|
-
errorMsg:
|
|
241
|
+
status: handleRevisionStatus(eventData.status),
|
|
242
|
+
errorCode: eventData.status?.error ? eventData.status.error.code : containerError?.code ?? "",
|
|
243
|
+
errorMsg: eventData.status?.error ? eventData.status.error.message : containerError?.message ?? "",
|
|
243
244
|
createdAt:
|
|
244
245
|
(eventData.status && eventData.status.runtime?.status?.createdAt) || "",
|
|
245
246
|
};
|