vjudge: prevent race

This commit is contained in:
undefined committed 2021-08-28 05:42:55 +08:00
1 parent 3027421101
commit dfe60b5890
2 files changed
+2 -2

No files matched your search

+1 -1
View File
@@ -42,7 +42,7 @@ class Service {
while (pids.length) {
logger.info(`${domainId}: Syncing page ${page}`);
for (const pid of pids) {
if (syncing[`${domainId}/${pid}`] || await ProblemModel.get(domainId, pid)) continue;
if (await ProblemModel.get(domainId, pid) || syncing[`${domainId}/${pid}`]) continue;
syncing[`${domainId}/${pid}`] = true;
try {
const res = await this.api.getProblem(pid);