package com.gcsc.connection.monitoring.scheduler;

import com.gcsc.connection.monitoring.service.HeartbeatService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class HeartbeatScheduler {

    private final HeartbeatService heartbeatService;

    /**
     * 주기적 헬스체크 스케줄러
     */
    @Scheduled(fixedDelayString = "${app.heartbeat.default-interval-seconds}000")
    public void scheduledHealthCheck() {
        log.debug("스케줄 헬스체크 시작");
        heartbeatService.checkAllActiveServices();
        log.debug("스케줄 헬스체크 완료");
    }
}
