mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
judge: ensure tmpdir
This commit is contained in:
1 parent
f834d9ca87
commit
c57b304576
2 files changed
+3
No files matched your search
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user