judge: add warning for no host configured

This commit is contained in:
undefined committed 2026-04-18 01:31:33 +08:00
1 parent 4a372ea0e3
commit 8096df45c3
2 files changed
+6 -2

No files matched your search

+5 -1
View File
@@ -14,7 +14,7 @@
import './utils';
import PQueue from 'p-queue';
import { fs } from '@hydrooj/utils';
import { fs, Time } from '@hydrooj/utils';
import { getConfig } from './config';
import HydroHost from './hosts/hydro';
import Vj4Host from './hosts/vj4';
@@ -53,6 +53,10 @@ async function daemon() {
const queue = new PQueue({ concurrency: Infinity });
await fs.ensureDir(getConfig('tmp_dir'));
queue.on('error', (e) => log.error(e));
if (!Object.keys(_hosts).length) {
log.warn('No host configured');
setInterval(() => log.warn('No host configured'), Time.hour);
}
for (const i in _hosts) {
_hosts[i].host ||= i;
hosts[i] = _hosts[i].type === 'vj4' ? new Vj4Host(_hosts[i]) : new HydroHost(_hosts[i]);