mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
vjudge: prevent race
This commit is contained in:
1 parent
3027421101
commit
dfe60b5890
2 files changed
+2
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@hydrooj/vjudge",
|
"name": "@hydrooj/vjudge",
|
||||||
"version": "1.2.2",
|
"version": "1.2.3",
|
||||||
"description": "Submit problems to remote oj",
|
"description": "Submit problems to remote oj",
|
||||||
"main": "package.json",
|
"main": "package.json",
|
||||||
"repository": "https://github.com/hydro-dev/Hydro.git",
|
"repository": "https://github.com/hydro-dev/Hydro.git",
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Service {
|
|||||||
while (pids.length) {
|
while (pids.length) {
|
||||||
logger.info(`${domainId}: Syncing page ${page}`);
|
logger.info(`${domainId}: Syncing page ${page}`);
|
||||||
for (const pid of pids) {
|
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;
|
syncing[`${domainId}/${pid}`] = true;
|
||||||
try {
|
try {
|
||||||
const res = await this.api.getProblem(pid);
|
const res = await this.api.getProblem(pid);
|
||||||
|
|||||||
Reference in new issue
Block a user