From 4691c6c2efe7fccc74c75eb01b91009791960259 Mon Sep 17 00:00:00 2001
From: zhangzengfei <zhangzengfei@smartai.com>
Date: 星期五, 17 五月 2024 22:59:32 +0800
Subject: [PATCH] 修复图片下载的bug

---
 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