@beastmode-develeap/beastmode 0.1.65 → 0.1.66
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/index.js +29 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4890,24 +4890,41 @@ function getBoardRoutes(factoryDir) {
|
|
|
4890
4890
|
}
|
|
4891
4891
|
}
|
|
4892
4892
|
let busySlots = 0;
|
|
4893
|
-
let totalSlots =
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
4898
|
-
|
|
4893
|
+
let totalSlots = 3;
|
|
4894
|
+
const slotsPath = join13(factoryDir, "daemon", "logs", ".slots.json");
|
|
4895
|
+
let usedDaemonSlotsFile = false;
|
|
4896
|
+
if (existsSync15(slotsPath)) {
|
|
4897
|
+
try {
|
|
4898
|
+
const slots = JSON.parse(readFileSync12(slotsPath, "utf-8"));
|
|
4899
|
+
if (typeof slots.busy === "number" && typeof slots.total === "number") {
|
|
4900
|
+
busySlots = slots.busy;
|
|
4901
|
+
totalSlots = slots.total;
|
|
4902
|
+
usedDaemonSlotsFile = true;
|
|
4903
|
+
}
|
|
4904
|
+
} catch {
|
|
4899
4905
|
}
|
|
4900
|
-
} catch {
|
|
4901
4906
|
}
|
|
4902
|
-
|
|
4903
|
-
if (existsSync15(configPath)) {
|
|
4907
|
+
if (!usedDaemonSlotsFile) {
|
|
4904
4908
|
try {
|
|
4905
|
-
const
|
|
4906
|
-
|
|
4907
|
-
|
|
4909
|
+
const poll = await proxyToBoard(boardUrl, "GET", "/api/poll");
|
|
4910
|
+
const workingItems = poll["working_on_it"];
|
|
4911
|
+
if (Array.isArray(workingItems)) {
|
|
4912
|
+
busySlots = workingItems.length;
|
|
4908
4913
|
}
|
|
4909
4914
|
} catch {
|
|
4910
4915
|
}
|
|
4916
|
+
for (const name of ["beastmode.docker.json", "beastmode.daemon.json"]) {
|
|
4917
|
+
const configPath = join13(factoryDir, "config", name);
|
|
4918
|
+
if (!existsSync15(configPath)) continue;
|
|
4919
|
+
try {
|
|
4920
|
+
const config = JSON.parse(readFileSync12(configPath, "utf-8"));
|
|
4921
|
+
if (typeof config.max_slots === "number") {
|
|
4922
|
+
totalSlots = config.max_slots;
|
|
4923
|
+
break;
|
|
4924
|
+
}
|
|
4925
|
+
} catch {
|
|
4926
|
+
}
|
|
4927
|
+
}
|
|
4911
4928
|
}
|
|
4912
4929
|
const alertsPath = join13(factoryDir, "daemon", "logs", ".alerts.json");
|
|
4913
4930
|
let alerts = [];
|