mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: upgrade: fix race condition
This commit is contained in:
1 parent
c116d6a212
commit
23822ea2f5
2 files changed
+6
-6
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "3.1.18",
|
"version": "3.1.19",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "src/loader",
|
"main": "src/loader",
|
||||||
"module": "src/loader",
|
"module": "src/loader",
|
||||||
|
|||||||
@@ -602,13 +602,13 @@ const scripts: UpgradeScript[] = [
|
|||||||
).toArray();
|
).toArray();
|
||||||
for (const ctdoc of ctdocs) {
|
for (const ctdoc of ctdocs) {
|
||||||
if (!ctdoc.journal?.filter((i) => isStringPid(i.pid)).length) continue;
|
if (!ctdoc.journal?.filter((i) => isStringPid(i.pid)).length) continue;
|
||||||
const $set = {
|
const journal = [];
|
||||||
journal: await Promise.all(ctdoc.journal.map(async (i) => {
|
for (const i of ctdoc.journal) {
|
||||||
const pdoc = await getProblem(doc.domainId, i.pid);
|
const pdoc = await getProblem(doc.domainId, i.pid);
|
||||||
if (pdoc) i.pid = pdoc.docId;
|
if (pdoc) i.pid = pdoc.docId;
|
||||||
return i;
|
journal.push(i);
|
||||||
})),
|
}
|
||||||
};
|
const $set = { journal };
|
||||||
await document.setStatus(doc.domainId, doc.docType, doc.docId, ctdoc.uid, $set);
|
await document.setStatus(doc.domainId, doc.docType, doc.docId, ctdoc.uid, $set);
|
||||||
}
|
}
|
||||||
await contest.edit(doc.domainId, doc.docId, { pids });
|
await contest.edit(doc.domainId, doc.docId, { pids });
|
||||||
|
|||||||
Reference in new issue
Block a user