You've already forked FrameTour-BE
2
This commit is contained in:
@@ -62,7 +62,7 @@ public class VideoPieceGetter {
|
||||
|
||||
@Data
|
||||
public static class Task {
|
||||
public List<Long> faceSampleIds;
|
||||
public List<Long> faceSampleIds = new ArrayList<>();
|
||||
public Callback callback;
|
||||
public Long memberId;
|
||||
public Long faceId;
|
||||
@@ -114,7 +114,7 @@ public class VideoPieceGetter {
|
||||
// taskStatusBiz.setFaceCutStatus(task.faceId, 0);
|
||||
// }
|
||||
AtomicBoolean invoke = new AtomicBoolean(false);
|
||||
ThreadPoolExecutor executor = new ThreadPoolExecutor(8, 16, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(32));
|
||||
final ThreadPoolExecutor executor = new ThreadPoolExecutor(16, 512, 0L, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(512));
|
||||
List<String> currentPlaceholder = new ArrayList<>();
|
||||
List<FaceSampleEntity> list = faceSampleMapper.listByIds(task.getFaceSampleIds());
|
||||
Collection<List<FaceSampleEntity>> collection = list.stream()
|
||||
@@ -128,7 +128,8 @@ public class VideoPieceGetter {
|
||||
.values();
|
||||
collection.forEach(faceSampleList -> {
|
||||
executor.execute(() -> {
|
||||
faceSampleList.parallelStream().forEach(faceSample -> {
|
||||
faceSampleList.parallelStream().forEach(faceSample -> {
|
||||
executor.execute(() -> {
|
||||
DeviceEntity device = deviceRepository.getDevice(faceSample.getDeviceId());
|
||||
DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId());
|
||||
|
||||
@@ -255,11 +256,15 @@ public class VideoPieceGetter {
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
try {
|
||||
executor.awaitTermination(Long.MAX_VALUE, TimeUnit.SECONDS);
|
||||
Thread.sleep(1000L);
|
||||
log.info("executor等待被结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
|
||||
executor.shutdown();
|
||||
executor.awaitTermination(5, TimeUnit.MINUTES);
|
||||
log.info("executor已结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
|
||||
} catch (InterruptedException e) {
|
||||
return;
|
||||
} finally {
|
||||
|
Reference in New Issue
Block a user