package cn.sikey.websocket.scheduler;

import cn.sikey.websocket.websocket.ConnectionManagerService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
public class KeepItAliveScheduler {

    @Resource
    private ConnectionManagerService connectionManagerService;

    /**
     * 检查Session上次活跃时间 <b>10秒检查一次</b>
     */
    @Scheduled(cron = "*/3 * * * * *")
    public void run() {
        connectionManagerService.removeDeadConnection();
    }
}
