mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
judge: sleep before final update
This commit is contained in:
1 parent
e38f413195
commit
57ee75bd4c
2 files changed
+3
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.14.3",
|
"version": "2.14.4",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export async function end(body: JudgeResultBody) {
|
|||||||
let rdoc = await record.get(body.domainId, body.rid);
|
let rdoc = await record.get(body.domainId, body.rid);
|
||||||
const $set: Partial<Rdoc> = {};
|
const $set: Partial<Rdoc> = {};
|
||||||
const $push: any = {};
|
const $push: any = {};
|
||||||
const $unset: { progress: '' } = { progress: '' };
|
const $unset: any = { progress: '' };
|
||||||
if (body.message) {
|
if (body.message) {
|
||||||
rdoc.judgeTexts.push(body.message);
|
rdoc.judgeTexts.push(body.message);
|
||||||
$push.judgeTexts = body.message;
|
$push.judgeTexts = body.message;
|
||||||
@@ -86,6 +86,7 @@ export async function end(body: JudgeResultBody) {
|
|||||||
if (body.memory !== undefined) $set.memory = body.memory;
|
if (body.memory !== undefined) $set.memory = body.memory;
|
||||||
$set.judgeAt = new Date();
|
$set.judgeAt = new Date();
|
||||||
$set.judger = body.judger ?? 1;
|
$set.judger = body.judger ?? 1;
|
||||||
|
await sleep(100); // Make sure that all 'next' event already triggered
|
||||||
rdoc = await record.update(body.domainId, body.rid, $set, $push, $unset);
|
rdoc = await record.update(body.domainId, body.rid, $set, $push, $unset);
|
||||||
await _postJudge(rdoc);
|
await _postJudge(rdoc);
|
||||||
bus.boardcast('record/change', rdoc); // trigger a full update
|
bus.boardcast('record/change', rdoc); // trigger a full update
|
||||||
|
|||||||
Reference in new issue
Block a user