mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
judge: daemon: 上报系统状态
This commit is contained in:
1 parent
9395ba1a7a
commit
a0b0e59389
6 files changed
+24
-4
No files matched your search
@@ -14,6 +14,7 @@ import { FormatError, CompileError, SystemError } from '../error';
|
||||
import { STATUS_COMPILE_ERROR, STATUS_SYSTEM_ERROR } from '../status';
|
||||
import readCases from '../cases';
|
||||
import judge from '../judge';
|
||||
import * as sysinfo from '../sysinfo';
|
||||
|
||||
class JudgeTask {
|
||||
stat: Record<string, Date>;
|
||||
@@ -258,7 +259,17 @@ export default class Hydro {
|
||||
}, 30000);
|
||||
});
|
||||
await new Promise((resolve) => {
|
||||
this.ws.once('open', () => { resolve(null); });
|
||||
this.ws.once('open', async () => {
|
||||
if (!this.config.noStatus) {
|
||||
const info = await sysinfo.get();
|
||||
this.ws.send(JSON.stringify({ key: 'status', info }));
|
||||
setInterval(async () => {
|
||||
const [mid, inf] = await sysinfo.update();
|
||||
this.ws.send(JSON.stringify({ key: 'status', info: { mid, ...inf } }));
|
||||
}, 1200000);
|
||||
}
|
||||
resolve(null);
|
||||
});
|
||||
});
|
||||
log.info(`[${this.config.host}] 已连接`);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user