core: 支持显示时空限制 (#65)

虽然有点丑,但是能用
This commit is contained in:
undefined committed 2021-04-10 18:44:07 +08:00
1 parent d5c5b3fd47
commit 1c89596cb3
20 files changed
+84 -59

No files matched your search

+6 -6
View File
@@ -25,8 +25,8 @@ const statusMap = {
function proc({
execute = '',
time_limit_ms = 16000,
memory_limit_mb = 1024,
time = 16000,
memory = 1024,
process_limit = 32,
stdin = '', copyIn = {}, copyOut = [], copyOutCached = [],
} = {}) {
@@ -39,9 +39,9 @@ function proc({
{ name: 'stdout', max: 1024 * 1024 * size },
{ name: 'stderr', max: 1024 * 1024 * size },
],
cpuLimit: time_limit_ms * 1000 * 1000,
realCpuLimit: time_limit_ms * 3000 * 1000,
memoryLimit: memory_limit_mb * 1024 * 1024,
cpuLimit: time * 1000 * 1000,
realCpuLimit: time * 3000 * 1000,
memoryLimit: memory * 1024 * 1024,
procLimit: process_limit,
copyIn,
copyOut,
@@ -58,7 +58,7 @@ async function adaptResult(result, params) {
files: result.files,
code: result.exitStatus,
};
if (ret.time_usage_ms >= (params.time_limit_ms || 16000)) {
if (ret.time_usage_ms >= (params.time || 16000)) {
ret.status = STATUS.STATUS_TIME_LIMIT_EXCEEDED;
}
ret.files = result.files || {};