From 9e8d8b630affc4a4be428c775264ef4b0e5104b3 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 17 五月 2024 15:25:45 +0800
Subject: [PATCH] 添加取消订阅接口
---
service/device.go | 10 ++++------
1 files changed, 4 insertions(+), 6 deletions(-)
diff --git a/service/device.go b/service/device.go
index acfaf18..6eeb1f2 100644
--- a/service/device.go
+++ b/service/device.go
@@ -3,7 +3,6 @@
import (
"encoding/json"
"time"
- "errors"
"gat1400Exchange/config"
"gat1400Exchange/pkg/logger"
@@ -16,7 +15,7 @@
var deviceAliveCache *expirable.LRU[string, bool]
func init() {
- deviceAliveCache = expirable.NewLRU[string, bool](100, nil, time.Second*60) //杩囨护鎸囧畾鏃堕棿鍐呯殑閲嶅浜虹墿
+ deviceAliveCache = expirable.NewLRU[string, bool](100, nil, time.Second*60)
}
type DevReportData struct {
@@ -38,22 +37,21 @@
}
func DeviceInfoReportTask() error {
- logger.Info("Start device info report task, server:%s.", config.ForwardConf.ReportServer)
-
if config.ServeConf.Role == "agent" {
return nil
}
if config.ForwardConf.ReportServer == "" {
- return errors.New("Server addr is empty!")
+ return nil
}
+
+ logger.Info("Start device info report task, server:%s.", config.ForwardConf.ReportServer)
var d models.Device
devices, err := d.FindAll()
if err != nil {
return err
}
-
for _, dev := range devices{
if _, exists := deviceAliveCache.Get(dev.Id); !exists {
--
Gitblit v1.8.0