Merge pull request #367 from Brikaa/constraints-bug

Fix important constraints bug
This commit is contained in:
Thomas Hobson 2021-10-13 06:43:26 +13:00 committed by GitHub
commit e97b6d426d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
run_timeout = run_timeout || rt.timeouts.run;
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(
new Job({
runtime: rt,

View File

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