MCPcopy Create free account
hub / github.com/hydro-dev/Hydro / getStatus

Function getStatus

packages/hydrooj/src/handler/status.ts:9–20  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7const coll = db.collection('status');
8
9async function getStatus() {
10 const stats = await coll.find().sort({ type: 1, updateAt: -1 }).toArray();
11 for (const stat of stats) {
12 let desc = '';
13 const online = new Date(stat.updateAt).getTime() > Date.now() - 300000;
14 if (!online) desc = 'Offline';
15 desc ||= 'Online';
16 stat.isOnline = online;
17 stat.status = desc;
18 }
19 return stats;
20}
21
22class StatusHandler extends Handler {
23 async get() {

Callers 1

getMethod · 0.70

Calls 1

findMethod · 0.80

Tested by

no test coverage detected