diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 9a1c68728..18bf8ec6c 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.20.2", + "version": "2.20.3", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/judge.ts b/packages/hydrooj/src/handler/judge.ts index 966e4623b..6ce9b5f08 100644 --- a/packages/hydrooj/src/handler/judge.ts +++ b/packages/hydrooj/src/handler/judge.ts @@ -87,28 +87,6 @@ export async function end(body: JudgeResultBody) { bus.boardcast('record/change', rdoc); // trigger a full update } -class JudgeHandler extends Handler { - async get({ check = false }) { - if (check) return; - const tasks = []; - let t = await task.getFirst({ type: 'judge' }); - while (t) { - tasks.push(t); - t = await task.getFirst({ type: 'judge' }); // eslint-disable-line no-await-in-loop - } - this.response.body = { tasks }; - } - - async postNext() { - await next(this.request.body); - } - - async postEnd() { - this.request.body.judger = this.user._id; - await end(this.request.body); - } -} - export class JudgeFilesDownloadHandler extends Handler { @post('files', Types.Set) @post('pid', Types.UnsignedInt) @@ -144,6 +122,9 @@ class JudgeConnectionHandler extends ConnectionHandler { } this.send({ task: t }); this.processing = t; + const $set = { status: builtin.STATUS.STATUS_FETCHED }; + const rdoc = await record.update(t.domainId, t.rid, $set, {}); + bus.boardcast('record/change', rdoc, $set, {}); } async message(msg) { @@ -165,7 +146,6 @@ class JudgeConnectionHandler extends ConnectionHandler { } export async function apply() { - Route('judge', '/judge', JudgeHandler, builtin.PRIV.PRIV_JUDGE); Route('judge_files_download', '/judge/files', JudgeFilesDownloadHandler, builtin.PRIV.PRIV_JUDGE); Connection('judge_conn', '/judge/conn', JudgeConnectionHandler, builtin.PRIV.PRIV_JUDGE); }