This commit is contained in:
2025-05-30 10:31:31 +08:00
parent 80f4491836
commit 5d2cf4fd31
4 changed files with 125 additions and 29 deletions

View File

@ -34,6 +34,13 @@ public class FaceCleanerTest {
private FaceSampleMapper faceSampleMapper;
@Autowired
private ScenicMapper scenicMapper;
@Autowired
private FaceCleaner faceCleaner;
@Test
public void testC() {
faceCleaner.cleanSourceOss();
}
@Test
public void test() {
@ -41,33 +48,7 @@ public class FaceCleanerTest {
List<ScenicRespVO> scenicList = scenicMapper.list(scenicQuery);
scenicList.forEach(scenic -> {
log.info("当前景区{},开始删除人脸样本", scenic.getName());
taskFaceService.batchDeleteExpiredFace(scenic.getId());
});
}
@Test
public void testC() {
List<List<Integer>> list = Arrays.asList(Arrays.asList(1,2,3), Arrays.asList(4,5,6), Arrays.asList(7,8,9), Arrays.asList(10,11,12));
ThreadPoolExecutor executor = new ThreadPoolExecutor(8, 16, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue<>(16));
list.parallelStream().forEach(integers -> {
executor.execute(() -> {
integers.forEach(integer -> {
executor.execute(() -> {
try {
Thread.sleep(1000);
} catch (InterruptedException ignored) {
}
log.info("{}", integer);
});
});
});
});
try {
Thread.sleep(2000);
executor.shutdown();
executor.awaitTermination(1, TimeUnit.MINUTES);
} catch (InterruptedException ignored) {
}
}
}