judge: support stdioLimit

This commit is contained in:
undefined committed 2022-12-16 05:19:59 +08:00
1 parent c7a331b551
commit 4958655ac9
2 files changed
+4 -2

No files matched your search

+3 -1
View File
@@ -40,6 +40,8 @@ interface Parameter {
env?: Record<string, string>;
/** redirect stdin & stdout */
filename?: string;
/** In megabytes */
stdioLimit?: number;
}
interface SandboxAdaptedResult {
@@ -72,7 +74,7 @@ function proc(params: Parameter): Cmd {
const copyOut = supportOptional
? params.copyOut
: (params.copyOut || []).map((i) => (i.endsWith('?') ? i.substring(0, i.length - 1) : i));
const size = parseMemoryMB(getConfig('stdio_size'));
const size = params.stdioLimit || params.cacheStdoutAndStderr ? parseMemoryMB(getConfig('stdio_size')) : 4;
const rate = getConfig('rate');
const copyOutCached = [...(params.copyOutCached || [])];
if (params.cacheStdoutAndStderr) copyOutCached.push(params.filename ? `${params.filename}.out?` : 'stdout', 'stderr');
+1 -1
View File
@@ -232,7 +232,7 @@ export default class RecordModel {
export function apply(ctx: Context) {
// Mark problem as deleted
ctx.on('problem/delete', (domainId, docId) => RecordModel.coll.updateMany({ domainId, pid: docId }, { $set: { pid: -1 } }));
ctx.on('problem/delete', (domainId, docId) => RecordModel.coll.deleteMany({ domainId, pid: docId }));
ctx.on('domain/delete', (domainId) => RecordModel.coll.deleteMany({ domainId }));
ctx.on('ready', () => db.ensureIndexes(
RecordModel.coll,