kitowall 6.9.0 → 6.11.0
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/dist/core/workshop.js +30 -16
- package/package.json +1 -1
package/dist/core/workshop.js
CHANGED
|
@@ -33,6 +33,7 @@ const fs_1 = require("../utils/fs");
|
|
|
33
33
|
const net_1 = require("../utils/net");
|
|
34
34
|
const logs_1 = require("./logs");
|
|
35
35
|
const exec_1 = require("../utils/exec");
|
|
36
|
+
const init_1 = require("./init");
|
|
36
37
|
const WE_APP_ID = 431960;
|
|
37
38
|
const SEARCH_TTL_MS = 10 * 60 * 1000;
|
|
38
39
|
const DEFAULT_PAGE_SIZE = 24;
|
|
@@ -1125,18 +1126,24 @@ async function workshopCoexistenceStatus() {
|
|
|
1125
1126
|
return { ok: true, snapshot, current };
|
|
1126
1127
|
}
|
|
1127
1128
|
async function workshopStop(options) {
|
|
1128
|
-
|
|
1129
|
+
const state = readActiveState();
|
|
1129
1130
|
const hadActive = !!state;
|
|
1130
1131
|
const stopped = [];
|
|
1131
1132
|
let shouldRestore = false;
|
|
1133
|
+
const monitor = options?.monitor;
|
|
1134
|
+
const stopAll = !!options?.all || !monitor;
|
|
1132
1135
|
if (state?.instances) {
|
|
1133
|
-
if (options?.
|
|
1134
|
-
const
|
|
1136
|
+
if (monitor && !options?.all) {
|
|
1137
|
+
const nextState = {
|
|
1138
|
+
...state,
|
|
1139
|
+
instances: { ...state.instances }
|
|
1140
|
+
};
|
|
1141
|
+
const inst = nextState.instances[monitor];
|
|
1135
1142
|
if (killPid(inst?.pid))
|
|
1136
|
-
stopped.push(
|
|
1137
|
-
delete
|
|
1138
|
-
if (Object.keys(
|
|
1139
|
-
writeActiveState(
|
|
1143
|
+
stopped.push(monitor);
|
|
1144
|
+
delete nextState.instances[monitor];
|
|
1145
|
+
if (Object.keys(nextState.instances).length > 0) {
|
|
1146
|
+
writeActiveState(nextState);
|
|
1140
1147
|
}
|
|
1141
1148
|
else {
|
|
1142
1149
|
clearActiveState();
|
|
@@ -1144,27 +1151,34 @@ async function workshopStop(options) {
|
|
|
1144
1151
|
}
|
|
1145
1152
|
}
|
|
1146
1153
|
else {
|
|
1147
|
-
for (const [monitor, inst] of Object.entries(state.instances)) {
|
|
1148
|
-
if (killPid(inst?.pid))
|
|
1149
|
-
stopped.push(monitor);
|
|
1150
|
-
}
|
|
1151
|
-
clearActiveState();
|
|
1152
1154
|
shouldRestore = true;
|
|
1155
|
+
stopped.push(...Object.keys(state.instances));
|
|
1153
1156
|
}
|
|
1154
1157
|
}
|
|
1155
|
-
else if (
|
|
1158
|
+
else if (stopAll) {
|
|
1159
|
+
shouldRestore = true;
|
|
1160
|
+
}
|
|
1161
|
+
// Use the same handoff strategy as "Repair": first restore the static stack,
|
|
1162
|
+
// then tear down rendercore/live processes so the user is not left with a gap.
|
|
1163
|
+
if (shouldRestore) {
|
|
1164
|
+
await (0, init_1.initKitowall)({ namespace: 'kitowall', apply: true, force: true });
|
|
1156
1165
|
await stopKnownLiveProcesses();
|
|
1157
1166
|
clearActiveState();
|
|
1158
|
-
|
|
1167
|
+
const coexist = await workshopCoexistenceExit();
|
|
1168
|
+
return {
|
|
1169
|
+
ok: true,
|
|
1170
|
+
stopped_instances: stopped,
|
|
1171
|
+
restored_units: coexist.restored,
|
|
1172
|
+
had_active: hadActive
|
|
1173
|
+
};
|
|
1159
1174
|
}
|
|
1160
1175
|
if (options?.all) {
|
|
1161
1176
|
await stopKnownLiveProcesses();
|
|
1162
1177
|
}
|
|
1163
|
-
const coexist = shouldRestore ? await workshopCoexistenceExit() : { ok: true, restored: [] };
|
|
1164
1178
|
return {
|
|
1165
1179
|
ok: true,
|
|
1166
1180
|
stopped_instances: stopped,
|
|
1167
|
-
restored_units:
|
|
1181
|
+
restored_units: [],
|
|
1168
1182
|
had_active: hadActive
|
|
1169
1183
|
};
|
|
1170
1184
|
}
|