package org.dromara.mqtt;

import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.dromara.mqtt.config.properties.MqttProperties;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Slf4j
@Component
@RequiredArgsConstructor
public class MqttCommandRetryTask {

    private final MqttCommandAckService ackService;
    private final MqttProperties mqttProperties;

    @Scheduled(fixedDelayString = "${mqtt.command-ack.scan-interval-ms:5000}")
    public void retryExpiredCommands() {
        if (ackService.isStartupCleanupReady() && mqttProperties.getCommandAck().isEnabled()) {
         //   log.info("[设备命令重新下发] 定时器调用成功 ");
            ackService.retryExpiredCommands();
        }
    }
}
