vjudge账号选择上悲观锁

This commit is contained in:
Himit_ZH 2021-08-09 01:23:21 +08:00
parent dbfd29ea78
commit e42de86d19
1 changed files with 3 additions and 2 deletions

View File

@ -66,7 +66,8 @@ public class RemoteJudgeReceiver {
QueryWrapper<RemoteJudgeAccount> remoteJudgeAccountQueryWrapper = new QueryWrapper<>();
remoteJudgeAccountQueryWrapper
.eq("status", true)
.eq("oj", remoteOJName);
.eq("oj", remoteOJName)
.last("for update"); // 开启悲观锁
List<RemoteJudgeAccount> remoteJudgeAccountList = remoteJudgeAccountService.list(remoteJudgeAccountQueryWrapper);
@ -138,7 +139,7 @@ public class RemoteJudgeReceiver {
} else {
try {
TimeUnit.SECONDS.sleep(1);
TimeUnit.SECONDS.sleep(2);
} catch (InterruptedException e) {
e.printStackTrace();
}