主动建thread

This commit is contained in:
Jerry Yan 2025-03-03 18:08:31 +08:00
parent 1ba4e6a9c3
commit ee7249d63b

View File

@ -123,10 +123,8 @@ public class VideoPieceGetter {
}) })
.collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId)) .collect(Collectors.groupingBy(FaceSampleEntity::getDeviceId))
.values(); .values();
collection collection.forEach(faceSampleList -> {
.stream() new Thread(() -> {
.parallel()
.forEach(faceSampleList -> {
faceSampleList.parallelStream().forEach(faceSample -> { faceSampleList.parallelStream().forEach(faceSample -> {
DeviceEntity device = deviceRepository.getDevice(faceSample.getDeviceId()); DeviceEntity device = deviceRepository.getDevice(faceSample.getDeviceId());
DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId()); DeviceConfigEntity config = deviceRepository.getDeviceConfig(faceSample.getDeviceId());
@ -254,7 +252,8 @@ public class VideoPieceGetter {
} }
} }
}); });
}); }).start();
});
if (task.faceId != null) { if (task.faceId != null) {
taskStatusBiz.setFaceCutStatus(task.faceId, 1); taskStatusBiz.setFaceCutStatus(task.faceId, 1);
} }