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
+8
-8
No files matched your search
@@ -602,13 +602,13 @@ const scripts: UpgradeScript[] = [
|
||||
).toArray();
|
||||
for (const ctdoc of ctdocs) {
|
||||
if (!ctdoc.journal?.filter((i) => isStringPid(i.pid)).length) continue;
|
||||
const $set = {
|
||||
journal: await Promise.all(ctdoc.journal.map(async (i) => {
|
||||
const pdoc = await getProblem(doc.domainId, i.pid);
|
||||
if (pdoc) i.pid = pdoc.docId;
|
||||
return i;
|
||||
})),
|
||||
};
|
||||
const journal = [];
|
||||
for (const i of ctdoc.journal) {
|
||||
const pdoc = await getProblem(doc.domainId, i.pid);
|
||||
if (pdoc) i.pid = pdoc.docId;
|
||||
journal.push(i);
|
||||
}
|
||||
const $set = { journal };
|
||||
await document.setStatus(doc.domainId, doc.docType, doc.docId, ctdoc.uid, $set);
|
||||
}
|
||||
await contest.edit(doc.domainId, doc.docId, { pids });
|
||||
|
||||
Reference in new issue
Block a user