mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-21 01:46:28 +08:00
judge: remove unused tmpdir
This commit is contained in:
1 parent
18d59edc82
commit
b292c6cfa3
9 files changed
+8
-42
No files matched your search
@@ -12,8 +12,7 @@ import { NextFunction, ParsedConfig } from './interface';
|
||||
import judge from './judge';
|
||||
import { Logger } from './log';
|
||||
import { CopyInFile } from './sandbox';
|
||||
import * as tmpfs from './tmpfs';
|
||||
import { compilerText, Lock, md5 } from './utils';
|
||||
import { compilerText, md5 } from './utils';
|
||||
|
||||
interface Session {
|
||||
getLang: (name: string) => LangConfig;
|
||||
@@ -32,7 +31,6 @@ export class JudgeTask {
|
||||
rid: string;
|
||||
lang: string;
|
||||
code: CopyInFile;
|
||||
tmpdir: string;
|
||||
input?: string;
|
||||
clean: (() => Promise<any>)[];
|
||||
data: FileInfo[];
|
||||
@@ -73,11 +71,7 @@ export class JudgeTask {
|
||||
};
|
||||
this.next = this.session.getNext(this);
|
||||
this.end = this.session.getEnd(this);
|
||||
this.tmpdir = path.resolve(getConfig('tmp_dir'), this.rid);
|
||||
this.clean = [];
|
||||
await Lock.acquire(`${host}/${this.source}/${this.rid}`);
|
||||
fs.ensureDirSync(this.tmpdir);
|
||||
tmpfs.mount(this.tmpdir, getConfig('tmpfs_size'));
|
||||
logger.info('Submission: %s/%s/%s', host, this.source, this.rid);
|
||||
await this.doSubmission();
|
||||
} catch (e) {
|
||||
@@ -100,11 +94,8 @@ export class JudgeTask {
|
||||
});
|
||||
}
|
||||
} finally {
|
||||
Lock.release(`${host}/${this.source}/${this.rid}`);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
for (const clean of this.clean) await clean()?.catch(() => null);
|
||||
tmpfs.umount(this.tmpdir);
|
||||
fs.removeSync(this.tmpdir);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user