@kumori/aurora-backend-handler 1.0.67 → 1.0.69
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/package.json +1 -1
- package/websocket-manager.ts +20 -0
package/package.json
CHANGED
package/websocket-manager.ts
CHANGED
|
@@ -75,6 +75,7 @@ import {
|
|
|
75
75
|
import { handleLinkEvent } from "./helpers/link-helper";
|
|
76
76
|
import { eventHelper } from "./backend-handler";
|
|
77
77
|
import { Revision } from "@kumori/aurora-interfaces/interfaces/revision-interface";
|
|
78
|
+
import { requestRevisionData } from "./api/service-api-service";
|
|
78
79
|
|
|
79
80
|
let WebSocketClass: any;
|
|
80
81
|
|
|
@@ -189,6 +190,7 @@ let isLoadingReporting = false;
|
|
|
189
190
|
const REPORTING_ITERATIONS = 5;
|
|
190
191
|
const REPORTING_INTERVAL = 1000;
|
|
191
192
|
let hasLoadedReportingOnce = false;
|
|
193
|
+
let recentlyUpdatedServices = new Map<string, Service>();
|
|
192
194
|
|
|
193
195
|
/**
|
|
194
196
|
* Helper function to safely stringify error objects
|
|
@@ -723,6 +725,20 @@ const handleEvent = async (message: WSMessage) => {
|
|
|
723
725
|
});
|
|
724
726
|
});
|
|
725
727
|
}
|
|
728
|
+
const revisionState = eventData.status?.state?.code;
|
|
729
|
+
if (revisionState === "DEPLOYED" && currentToken) {
|
|
730
|
+
const serviceKey = `${parentParts.tenant}/${parentParts.service}`;
|
|
731
|
+
const serviceToRefresh = recentlyUpdatedServices.get(serviceKey);
|
|
732
|
+
if (serviceToRefresh) {
|
|
733
|
+
recentlyUpdatedServices.delete(serviceKey);
|
|
734
|
+
requestRevisionData(serviceToRefresh, currentToken).catch((err) => {
|
|
735
|
+
console.error(
|
|
736
|
+
`[ws] Error fetching revision data after DEPLOYED for ${serviceKey}:`,
|
|
737
|
+
err,
|
|
738
|
+
);
|
|
739
|
+
});
|
|
740
|
+
}
|
|
741
|
+
}
|
|
726
742
|
break;
|
|
727
743
|
case "service":
|
|
728
744
|
const serviceResult = handleServiceEvent({
|
|
@@ -1285,6 +1301,10 @@ const handleOperationSuccess = (operation: PendingOperation, response: any) => {
|
|
|
1285
1301
|
eventHelper.service.publish.deployed(svcSuccessResult.updatedService);
|
|
1286
1302
|
} else if (svcSuccessResult.eventType === "updated") {
|
|
1287
1303
|
eventHelper.service.publish.updated(svcSuccessResult.updatedService);
|
|
1304
|
+
recentlyUpdatedServices.set(
|
|
1305
|
+
svcSuccessResult.serviceId,
|
|
1306
|
+
svcSuccessResult.updatedService,
|
|
1307
|
+
);
|
|
1288
1308
|
} else if (svcSuccessResult.eventType === "deleting") {
|
|
1289
1309
|
eventHelper.service.publish.updated(svcSuccessResult.updatedService);
|
|
1290
1310
|
}
|