Fix important constraints bug

This commit is contained in:
Brikaa 2021-10-10 19:11:16 +02:00
parent 90945d1621
commit 2f114d6e54
2 changed files with 13 additions and 10 deletions

View File

@ -129,7 +129,7 @@ function get_job(body) {
compile_timeout = compile_timeout || rt.timeouts.compile; compile_timeout = compile_timeout || rt.timeouts.compile;
run_timeout = run_timeout || rt.timeouts.run; run_timeout = run_timeout || rt.timeouts.run;
compile_memory_limit = compile_memory_limit || rt.memory_limits.compile; compile_memory_limit = compile_memory_limit || rt.memory_limits.compile;
run_timeout = run_timeout || rt.timeouts.run; run_memory_limit = run_memory_limit || rt.memory_limits.run;
resolve( resolve(
new Job({ new Job({
runtime: rt, runtime: rt,

View File

@ -27,7 +27,7 @@ setInterval(() => {
}, 10); }, 10);
class Job { class Job {
constructor({ runtime, files, args, stdin }) { constructor({ runtime, files, args, stdin, timeouts, memory_limits }) {
this.uuid = uuidv4(); this.uuid = uuidv4();
this.runtime = runtime; this.runtime = runtime;
this.files = files.map((file, i) => ({ this.files = files.map((file, i) => ({
@ -38,6 +38,9 @@ class Job {
this.args = args; this.args = args;
this.stdin = stdin; this.stdin = stdin;
this.timeouts = timeouts;
this.memory_limits = memory_limits;
this.uid = config.runner_uid_min + uid; this.uid = config.runner_uid_min + uid;
this.gid = config.runner_gid_min + gid; this.gid = config.runner_gid_min + gid;
@ -220,8 +223,8 @@ class Job {
compile = await this.safe_call( compile = await this.safe_call(
path.join(this.runtime.pkgdir, 'compile'), path.join(this.runtime.pkgdir, 'compile'),
this.files.map(x => x.name), this.files.map(x => x.name),
this.runtime.timeouts.compile, this.timeouts.compile,
this.runtime.memory_limits.compile this.memory_limits.compile
); );
} }
@ -230,8 +233,8 @@ class Job {
const run = await this.safe_call( const run = await this.safe_call(
path.join(this.runtime.pkgdir, 'run'), path.join(this.runtime.pkgdir, 'run'),
[this.files[0].name, ...this.args], [this.files[0].name, ...this.args],
this.runtime.timeouts.run, this.timeouts.run,
this.runtime.memory_limits.run this.memory_limits.run
); );
this.state = job_states.EXECUTED; this.state = job_states.EXECUTED;
@ -263,8 +266,8 @@ class Job {
const { error, code, signal } = await this.safe_call( const { error, code, signal } = await this.safe_call(
path.join(this.runtime.pkgdir, 'compile'), path.join(this.runtime.pkgdir, 'compile'),
this.files.map(x => x.name), this.files.map(x => x.name),
this.runtime.timeouts.compile, this.timeouts.compile,
this.runtime.memory_limits.compile, this.memory_limits.compile,
eventBus eventBus
); );
@ -276,8 +279,8 @@ class Job {
const { error, code, signal } = await this.safe_call( const { error, code, signal } = await this.safe_call(
path.join(this.runtime.pkgdir, 'run'), path.join(this.runtime.pkgdir, 'run'),
[this.files[0].name, ...this.args], [this.files[0].name, ...this.args],
this.runtime.timeouts.run, this.timeouts.run,
this.runtime.memory_limits.run, this.memory_limits.run,
eventBus eventBus
); );