| | |
| | | @Component |
| | | @Slf4j |
| | | public class ScheduledTasks { |
| | | // private static final Logger log = LoggerFactory.getLogger(ScheduledTasks.class); |
| | | private static final DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss"); |
| | | |
| | | @Autowired |
| | | private KeywordTaskService keywordTaskService; |
| | | |
| | | @Autowired |
| | | private CollectController collectController; |
| | | @Autowired |
| | |
| | | @Autowired |
| | | private QuestionService questionService; |
| | | |
| | | private String baseUrl = "http://thirdparty-service"; // 第三方服务基础URL |
| | | private ScheduledFuture<?> scheduledTask; // 定时任务引用 |
| | | // 健康检查专用调度器(单线程足够) |
| | | private final ScheduledExecutorService healthCheckScheduler = Executors.newSingleThreadScheduledExecutor(); |
| | |
| | | log.error("处理任务 {} 状态时发生错误: {}", task.getTask_id(), e.getMessage()); |
| | | task.setStatus("error"); |
| | | |
| | | // 修改这里:将updateById的结果包装成Mono |
| | | // 将updateById的结果包装成Mono |
| | | return Mono.fromSupplier(() -> keywordTaskService.updateById(task)) |
| | | .thenReturn(task); |
| | | }); |