judge: ensure tmpdir

This commit is contained in:
undefined committed 2023-01-31 08:27:51 +08:00
1 parent f834d9ca87
commit c57b304576
2 files changed
+3

No files matched your search

+2
View File
@@ -15,6 +15,7 @@
~ */
import './utils';
import fs from 'fs-extra';
import PQueue from 'p-queue';
import { getConfig } from './config';
import HydroHost from './hosts/hydro';
@@ -45,6 +46,7 @@ process.on('unhandledRejection', (reason, p) => {
async function daemon() {
const _hosts = getConfig('hosts');
const queue = new PQueue({ concurrency: Infinity });
await fs.ensureDir(getConfig('tmp_dir'));
queue.on('error', (e) => log.error(e));
for (const i in _hosts) {
_hosts[i].host ||= i;
+1
View File
@@ -75,6 +75,7 @@ const session = {
export async function postInit() {
if (SystemModel.get('hydrojudge.disable')) return;
await fs.ensureDir(getConfig('tmp_dir'));
const handle = async (t) => {
const rdoc = await RecordModel.get(t.domainId, t.rid);
(new JudgeTask(session, Object.assign(rdoc, t))).handle().catch(logger.error);