[sandbox] Catch run errors and fetch more often
This commit is contained in:
parent
2f06247f6d
commit
149037cf7d
@ -65,13 +65,18 @@ async function cloneAndRun(submissionData: SubmissionGetData) {
|
||||
);
|
||||
await git.checkout(submissionData.submission.commitHash);
|
||||
const problemName = submissionData.submission.problem.pascalName;
|
||||
const output = await runJava(
|
||||
let output: string;
|
||||
try {
|
||||
output = await runJava(
|
||||
javaBinPath,
|
||||
buildDir,
|
||||
join(repoDir, problemName, problemName + '.java'),
|
||||
problemName,
|
||||
submissionData.submission.problem.realInput
|
||||
);
|
||||
} catch (error) {
|
||||
output = `[An error occurred while running]\n${error}`;
|
||||
}
|
||||
|
||||
const res = await fetch(urlJoin(adminUrl, 'api/submission'), {
|
||||
method: 'POST',
|
||||
@ -128,7 +133,7 @@ async function loop() {
|
||||
async function run() {
|
||||
while (true) {
|
||||
await loop();
|
||||
await new Promise((resolve) => setTimeout(resolve, 15000));
|
||||
await new Promise((resolve) => setTimeout(resolve, 10000));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,8 +1,5 @@
|
||||
import fs from 'fs-extra';
|
||||
import { join } from 'path';
|
||||
import os from 'os';
|
||||
import { exec, spawn } from 'child_process';
|
||||
import { error } from 'console';
|
||||
import util from 'util';
|
||||
|
||||
const execPromise = util.promisify(exec);
|
||||
|
Loading…
Reference in New Issue
Block a user