|
@@ -21,6 +21,7 @@ import java.util.Map;
|
|
|
import java.util.Set;
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
import java.util.concurrent.Executors;
|
|
|
+import java.util.concurrent.atomic.AtomicInteger;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -77,6 +78,7 @@ public class FaceVerifyJobHandler {
|
|
|
|
|
|
// 创建线程池
|
|
|
ExecutorService executorService = Executors.newFixedThreadPool(param.getMaxThreadNum());
|
|
|
+ AtomicInteger successCount = new AtomicInteger();
|
|
|
for (Map.Entry<Long, List<ExamCaptureQueueEntity>> entry : maps.entrySet()) {
|
|
|
executorService.execute(() -> {
|
|
|
// 分别按“考试记录ID”集中处理该“考试记录ID”下的抓拍照片队列记录(通常只有几条)
|
|
@@ -85,12 +87,9 @@ public class FaceVerifyJobHandler {
|
|
|
|
|
|
try {
|
|
|
SequenceLockHelper.getLockSimple(lockKey);
|
|
|
- examCaptureQueueService.handlerExamCaptureQueuesByExamRecordDataId(examRecordDataId, entry.getValue(), param);
|
|
|
+ examCaptureQueueService.handlerExamCaptureQueuesByExamRecordDataId(examRecordDataId, entry.getValue(), param, successCount);
|
|
|
} catch (Exception e) {
|
|
|
- if (e instanceof InterruptedException) {
|
|
|
- // 若线程终止,则抛出交由任务调度中心处理
|
|
|
- log.warn("当前人脸比对任务线程被终止!examRecordDataId:{}, error:{}", examRecordDataId, e.getMessage());
|
|
|
- } else if (e instanceof SequenceLockException) {
|
|
|
+ if (e instanceof SequenceLockException) {
|
|
|
// 若锁问题,下次会继续执行
|
|
|
log.warn("当前人脸比对任务获取锁失败!examRecordDataId:{}, redisKey:{}", examRecordDataId, lockKey);
|
|
|
} else {
|
|
@@ -110,8 +109,9 @@ public class FaceVerifyJobHandler {
|
|
|
}
|
|
|
|
|
|
long allCost = Math.max((System.currentTimeMillis() - startTime) / 1000, 1);
|
|
|
- log.warn("分片任务_FACE_{}_{} 本次处理比对照片数:{} 约{}个每秒 threadNum:{} cost:{}s", shardTotal, shardIndex,
|
|
|
- todoQueues.size(), (double) todoQueues.size() / allCost, param.getMaxThreadNum(), allCost);
|
|
|
+ log.warn("分片任务_FACE_{}_{} 本次处理比对照片数:{} 成功数:{} 约{}个每秒 threadNum:{} cost:{}s",
|
|
|
+ shardTotal, shardIndex, todoQueues.size(), successCount.get(), (float) todoQueues.size() / allCost,
|
|
|
+ param.getMaxThreadNum(), allCost);
|
|
|
}
|
|
|
|
|
|
private FaceApiParam parseJobParam(String jobParam) {
|