Junjie
8 天以前 9a8018c3fbc94f99d5d184c8cb1ef23d7366cea0
src/main/java/com/zy/core/utils/DeviceLogRedisKeyBuilder.java
@@ -4,8 +4,6 @@
import com.zy.core.enums.RedisKeyType;
import com.zy.core.enums.SlaveType;
import java.util.UUID;
public class DeviceLogRedisKeyBuilder {
    public static String build(DeviceDataLog deviceDataLog) {
@@ -16,11 +14,9 @@
                ? "unknown"
                : String.valueOf(deviceDataLog.getDeviceNo());
        String stationPart = buildStationPart(deviceDataLog, type);
        long millis = deviceDataLog != null && deviceDataLog.getCreateTime() != null
                ? deviceDataLog.getCreateTime().getTime()
                : System.currentTimeMillis();
        String uuid = UUID.randomUUID().toString().replace("-", "");
        return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + stationPart + ":" + millis + ":" + uuid;
        // 日志发布器按 lane 只保留最新快照,Redis key 必须稳定,否则会把每次采样都堆成独立 key,
        // 让 DeviceLogScheduler 的消费速度永远追不上写入速度,最终把 Redis 内存打爆。
        return RedisKeyType.DEVICE_LOG_KEY.key + type + ":" + deviceNo + stationPart;
    }
    private static String buildStationPart(DeviceDataLog deviceDataLog, String type) {