解决cf提交失败的情况
This commit is contained in:
parent
e97904d082
commit
b1738e61b4
|
@ -5,6 +5,7 @@ import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import top.hcode.hoj.pojo.entity.Judge;
|
import top.hcode.hoj.pojo.entity.Judge;
|
||||||
|
@ -36,6 +37,7 @@ public class RemoteJudgeGetResult {
|
||||||
private RemoteJudgeAccountServiceImpl remoteJudgeAccountService;
|
private RemoteJudgeAccountServiceImpl remoteJudgeAccountService;
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
|
@Async
|
||||||
public void sendTask(String remoteJudge, String username, String password, Long submitId, String uid,
|
public void sendTask(String remoteJudge, String username, String password, Long submitId, String uid,
|
||||||
Long cid, Long pid, Long resultSubmitId, String cookies) {
|
Long cid, Long pid, Long resultSubmitId, String cookies) {
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.scheduling.annotation.Async;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import top.hcode.hoj.pojo.entity.Judge;
|
import top.hcode.hoj.pojo.entity.Judge;
|
||||||
import top.hcode.hoj.pojo.entity.RemoteJudgeAccount;
|
import top.hcode.hoj.pojo.entity.RemoteJudgeAccount;
|
||||||
|
@ -33,7 +34,7 @@ public class RemoteJudgeToSubmit {
|
||||||
@Value("${hoj-judge-server.name}")
|
@Value("${hoj-judge-server.name}")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
@Async
|
||||||
public void sendTask(String username, String password, String remoteJudge, String remotePid, Long submitId,
|
public void sendTask(String username, String password, String remoteJudge, String remotePid, Long submitId,
|
||||||
String uid, Long cid, Long pid, String language, String userCode) {
|
String uid, Long cid, Long pid, String language, String userCode) {
|
||||||
|
|
||||||
|
|
|
@ -184,7 +184,7 @@ public class CodeForcesJudge implements RemoteJudgeStrategy {
|
||||||
//CSS渲染禁止
|
//CSS渲染禁止
|
||||||
webClient.getOptions().setCssEnabled(false);
|
webClient.getOptions().setCssEnabled(false);
|
||||||
//超时时间
|
//超时时间
|
||||||
webClient.getOptions().setTimeout(6000);
|
webClient.getOptions().setTimeout(4000);
|
||||||
|
|
||||||
//设置js抛出异常:false
|
//设置js抛出异常:false
|
||||||
webClient.getOptions().setThrowExceptionOnScriptError(false);
|
webClient.getOptions().setThrowExceptionOnScriptError(false);
|
||||||
|
@ -216,7 +216,7 @@ public class CodeForcesJudge implements RemoteJudgeStrategy {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void submitCode(WebClient webClient, String problemID, String languageID, String code) throws IOException {
|
public void submitCode(WebClient webClient, String problemID, String languageID, String code) throws IOException {
|
||||||
webClient.getOptions().setTimeout(30000);
|
webClient.getOptions().setTimeout(40000);
|
||||||
// 模拟浏览器打开一个目标网址
|
// 模拟浏览器打开一个目标网址
|
||||||
HtmlPage page = webClient.getPage(HOST + SUBMIT_URL);
|
HtmlPage page = webClient.getPage(HOST + SUBMIT_URL);
|
||||||
|
|
||||||
|
|
|
@ -394,6 +394,7 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
init() {
|
init() {
|
||||||
|
this.checkStatusNum = 0;
|
||||||
this.contestID = this.$route.params.contestID;
|
this.contestID = this.$route.params.contestID;
|
||||||
let query = this.$route.query;
|
let query = this.$route.query;
|
||||||
this.formFilter.problemID = query.problemID;
|
this.formFilter.problemID = query.problemID;
|
||||||
|
|
Loading…
Reference in New Issue