You've already forked FrameTour-BE
perf(task): 优化渲染任务轮询频率并修复重试计数逻辑
- 将定时轮询间隔从5秒调整为4秒 - 修改调度注解将执行频率从每5秒一次改为每3秒一次 - 移除异常处理中的incrementRetryCount调用避免事务回滚影响 - 添加注释说明外层handleProcessError负责重试次数增加
This commit is contained in:
@@ -51,9 +51,9 @@ public class RenderJobPollingService {
|
||||
private final MemberRelationRepository memberRelationRepository;
|
||||
|
||||
/**
|
||||
* 定时轮询间隔:5秒
|
||||
* 定时轮询间隔:4秒
|
||||
*/
|
||||
private static final int POLL_INTERVAL_SECONDS = 5;
|
||||
private static final int POLL_INTERVAL_SECONDS = 4;
|
||||
|
||||
/**
|
||||
* 每次查询的最大记录数
|
||||
@@ -62,9 +62,9 @@ public class RenderJobPollingService {
|
||||
|
||||
/**
|
||||
* 定时轮询渲染作业状态
|
||||
* 每5秒执行一次
|
||||
* 每3秒执行一次
|
||||
*/
|
||||
@Scheduled(fixedDelay = 5000, initialDelay = 10000)
|
||||
@Scheduled(fixedDelay = 3000)
|
||||
public void pollRenderJobs() {
|
||||
try {
|
||||
log.debug("[渲染轮询] 开始轮询渲染作业状态");
|
||||
@@ -125,7 +125,8 @@ public class RenderJobPollingService {
|
||||
jobStatus = renderJobService.getJobStatus(renderJobId);
|
||||
} catch (Exception e) {
|
||||
log.warn("[渲染轮询] 查询作业状态失败, renderJobId: {}, error: {}", renderJobId, e.getMessage());
|
||||
mappingMapper.incrementRetryCount(mapping.getId());
|
||||
// 注:此处不调用incrementRetryCount,因为@Transactional会回滚
|
||||
// 外层handleProcessError会负责增加重试次数
|
||||
throw e;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user