package com.zy.ai.timer; import com.zy.ai.service.AutoTuneCoordinatorService; import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.scheduling.annotation.Scheduled; import org.springframework.stereotype.Component; @Slf4j @Component public class AutoTuneScheduler { @Autowired private AutoTuneCoordinatorService autoTuneCoordinatorService; @Scheduled(cron = "0 * * * * ? ") public void runAutoTune() { try { AutoTuneCoordinatorService.AutoTuneCoordinatorResult result = autoTuneCoordinatorService.runAutoTuneIfEligible(); if (Boolean.TRUE.equals(result.getSkipped())) { log.debug("Auto tune scheduler skipped, reason={}", result.getReason()); return; } log.info("Auto tune scheduler triggered, success={}", result.getAgentResult() == null ? null : result.getAgentResult().getSuccess()); } catch (Exception exception) { log.error("Auto tune scheduler failed", exception); } } }