diff options
Diffstat (limited to 'slowcord')
-rw-r--r-- | slowcord/status/src/index.ts | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/slowcord/status/src/index.ts b/slowcord/status/src/index.ts index 82a15d1c..afec4743 100644 --- a/slowcord/status/src/index.ts +++ b/slowcord/status/src/index.ts @@ -58,7 +58,7 @@ const saveSystemUsage = async (load: number, procUptime: number, sysUptime: numb catch (e) { console.error(e); } -} +}; const makeTimedRequest = (path: string, body?: object): Promise<number> => new Promise((resolve, reject) => { const opts = { @@ -85,7 +85,7 @@ const makeTimedRequest = (path: string, body?: object): Promise<number> => new P res.on("end", () => { end = Date.now(); resolve(end - start); - }) + }); }); req.on("finish", () => { @@ -134,13 +134,17 @@ const app = async () => { await measureApi("login", `${instance.app}/login`); // await gatewayMeasure("websocketPing"); - const res = await fetch(`${instance.api}/-/monitorz`, { - headers: { - Authorization: process.env.INSTANCE_TOKEN as string, - } - }); - const json = await res.json() as monitorzSchema; - await saveSystemUsage(json.load[2], json.procUptime, json.sysUptime, json.memPercent); + try { + const res = await fetch(`${instance.api}/-/monitorz`, { + headers: { + Authorization: process.env.INSTANCE_TOKEN as string, + } + }); + const json = await res.json() as monitorzSchema; + await saveSystemUsage(json.load[1], json.procUptime, json.sysUptime, json.memPercent); + } + catch (e) { + } setTimeout(doMeasurements, parseInt(process.env.MEASURE_INTERVAL as string)); }; |