fix(video): 调整视频处理任务参数以优化性能

- 将探测大小从 32M 减小到 16M 以减少内存占用
- 修改线程池关闭前的等待时间从 5 分钟缩短至 3 分钟
- 添加注释说明批量定时停止的目的
This commit is contained in:
2025-12-15 13:56:54 +08:00
parent 3c838ec36e
commit adabe88648

View File

@@ -84,7 +84,7 @@ public class VideoPieceGetter {
@Autowired @Autowired
private MemberRelationRepository memberRelationRepository; private MemberRelationRepository memberRelationRepository;
public static final String PROBE_SIZE = "32M"; public static final String PROBE_SIZE = "16M";
@Data @Data
public static class Task { public static class Task {
@@ -141,6 +141,7 @@ public class VideoPieceGetter {
// taskStatusBiz.setFaceCutStatus(task.faceId, 0); // taskStatusBiz.setFaceCutStatus(task.faceId, 0);
// } // }
AtomicBoolean invoke = new AtomicBoolean(false); AtomicBoolean invoke = new AtomicBoolean(false);
// 为了批量定时停止
final ThreadFactory threadFactory = new ThreadFactoryBuilder() final ThreadFactory threadFactory = new ThreadFactoryBuilder()
.setNamePrefix("VPG-" + task.faceId + "-t") .setNamePrefix("VPG-" + task.faceId + "-t")
.build(); .build();
@@ -264,7 +265,7 @@ public class VideoPieceGetter {
Thread.sleep(1000L); Thread.sleep(1000L);
log.info("executor等待被结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount()); log.info("executor等待被结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
executor.shutdown(); executor.shutdown();
executor.awaitTermination(5, TimeUnit.MINUTES); executor.awaitTermination(3, TimeUnit.MINUTES);
log.info("executor已结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount()); log.info("executor已结束![A:{}/T:{}/F:{}]", executor.getActiveCount(), executor.getTaskCount(), executor.getCompletedTaskCount());
executor.close(); executor.close();
} catch (InterruptedException e) { } catch (InterruptedException e) {