|
@@ -2,6 +2,7 @@ package cn.com.qmth.examcloud.core.oe.student.face.starter.config;
|
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
|
|
|
|
|
+import org.apache.logging.log4j.ThreadContext;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.boot.ApplicationArguments;
|
|
import org.springframework.boot.ApplicationArguments;
|
|
import org.springframework.boot.ApplicationRunner;
|
|
import org.springframework.boot.ApplicationRunner;
|
|
@@ -48,20 +49,27 @@ public class ProcessBaiduFacelivenessTask implements ApplicationRunner {
|
|
|
|
|
|
for (ExamCaptureQueueEntity offeredQueueEntity : examCaptureQueueList) {
|
|
for (ExamCaptureQueueEntity offeredQueueEntity : examCaptureQueueList) {
|
|
while (true) {
|
|
while (true) {
|
|
- boolean offerSuccess = concurrentTask.offerElement(offeredQueueEntity);
|
|
|
|
- if (offerSuccess) {
|
|
|
|
- offeredQueueEntity.setProcessBatchNum(processBatchNum);
|
|
|
|
- examCaptureQueueRepo.save(offeredQueueEntity);
|
|
|
|
|
|
+ try{
|
|
|
|
+ ThreadContext.put("TRACE_ID", "Q_" + offeredQueueEntity.getId());
|
|
|
|
+ ThreadContext.put("CALLER", "BAIDU_TASK");
|
|
|
|
+ boolean offerSuccess = concurrentTask.offerElement(offeredQueueEntity);
|
|
|
|
+ if (offerSuccess) {
|
|
|
|
+ offeredQueueEntity.setProcessBatchNum(processBatchNum);
|
|
|
|
+ examCaptureQueueRepo.save(offeredQueueEntity);
|
|
|
|
+
|
|
|
|
+ captureLog.debug("[PROCESS_BAIDUFACELIVENESS." + processBatchNum
|
|
|
|
+ + "] 向工作队列中添加数据成功:fileUrl=" + offeredQueueEntity.getFileUrl());
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
|
|
captureLog.debug("[PROCESS_BAIDUFACELIVENESS." + processBatchNum
|
|
captureLog.debug("[PROCESS_BAIDUFACELIVENESS." + processBatchNum
|
|
- + "] 向工作队列中添加数据成功:fileUrl=" + offeredQueueEntity.getFileUrl());
|
|
|
|
- break;
|
|
|
|
- }
|
|
|
|
|
|
+ + "] 向工作队列中添加数据失败,30秒后重试:fileUrl=" + offeredQueueEntity.getFileUrl());
|
|
|
|
|
|
- captureLog.debug("[PROCESS_BAIDUFACELIVENESS." + processBatchNum
|
|
|
|
- + "] 向工作队列中添加数据失败,30秒后重试:fileUrl=" + offeredQueueEntity.getFileUrl());
|
|
|
|
|
|
+ Util.sleep(PropertyHolder.getInt("$capture.queue.offer.sleepSeconds.", 30));
|
|
|
|
+ }finally {
|
|
|
|
+ ThreadContext.clearAll();
|
|
|
|
+ }
|
|
|
|
|
|
- Util.sleep(PropertyHolder.getInt("$capture.queue.offer.sleepSeconds.", 30));
|
|
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return examCaptureQueueList.size();
|
|
return examCaptureQueueList.size();
|