mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 12:13:48 +01:00
fix: 🐛 empty fs stat
This commit is contained in:
parent
6e311c6612
commit
6d75115a38
@ -1,7 +1,7 @@
|
|||||||
import * as os from "node:os";
|
import * as os from "node:os";
|
||||||
import si from "systeminformation";
|
import si from "systeminformation";
|
||||||
import define from "../define.js";
|
import define from "../define.js";
|
||||||
import meilisearch from "../../../db/meilisearch.js";
|
import meilisearch from "@/db/meilisearch.js";
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: false,
|
requireCredential: false,
|
||||||
@ -19,7 +19,15 @@ export const paramDef = {
|
|||||||
export default define(meta, paramDef, async () => {
|
export default define(meta, paramDef, async () => {
|
||||||
const memStats = await si.mem();
|
const memStats = await si.mem();
|
||||||
const fsStats = await si.fsSize();
|
const fsStats = await si.fsSize();
|
||||||
const meilisearchStats = await meilisearchStatus();
|
|
||||||
|
let fsIndex = 0;
|
||||||
|
// Get the first index of fs sizes that are actualy used.
|
||||||
|
for (const [i, stat] of fsStats.entries()) {
|
||||||
|
if (stat.rw === true && stat.used > 0) {
|
||||||
|
fsIndex = i;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
machine: os.hostname(),
|
machine: os.hostname(),
|
||||||
@ -31,8 +39,8 @@ export default define(meta, paramDef, async () => {
|
|||||||
total: memStats.total,
|
total: memStats.total,
|
||||||
},
|
},
|
||||||
fs: {
|
fs: {
|
||||||
total: fsStats[0].size,
|
total: fsStats[fsIndex].size,
|
||||||
used: fsStats[0].used,
|
used: fsStats[fsIndex].used,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user