From 7dd5082bac6984f1e3b64deb02b025e88c27bb7a Mon Sep 17 00:00:00 2001 From: ssongliu <73214554+ssongliu@users.noreply.github.com> Date: Wed, 12 Jul 2023 16:39:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=BC=82=E5=B8=B8=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A2=9E=E5=8A=A0=E6=97=A5=E5=BF=97=E6=89=93?= =?UTF-8?q?=E5=8D=B0=20(#1622)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/app/service/monitor.go | 6 ++++-- backend/app/service/snapshot.go | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/backend/app/service/monitor.go b/backend/app/service/monitor.go index 320b20134d65..bd041b89647c 100644 --- a/backend/app/service/monitor.go +++ b/backend/app/service/monitor.go @@ -148,14 +148,16 @@ func loadNetIO() { if net2.BytesSent != 0 && net1.BytesSent != 0 { itemNet.Up = float64(net2.BytesSent-net1.BytesSent) / 1024 / 60 } - if itemNet.Up > 100000000 { + if itemNet.Up > 10485760 { + itemNet.Up = 0 global.LOG.Errorf("net2: %v, net1: %v, BytesSent: %v \n", net2.BytesSent, net1.BytesSent, float64(net2.BytesSent-net1.BytesSent)/1024/60) } if net2.BytesRecv != 0 && net1.BytesRecv != 0 { itemNet.Down = float64(net2.BytesRecv-net1.BytesRecv) / 1024 / 60 } - if itemNet.Down > 100000000 { + if itemNet.Down > 10485760 { + itemNet.Down = 0 global.LOG.Errorf("net2: %v, net1: %v, BytesRecv: %v \n", net2.BytesRecv, net1.BytesRecv, float64(net2.BytesRecv-net1.BytesRecv)/1024/60) } netList = append(netList, itemNet) diff --git a/backend/app/service/snapshot.go b/backend/app/service/snapshot.go index 09ce7594abbe..7d75b48f0349 100644 --- a/backend/app/service/snapshot.go +++ b/backend/app/service/snapshot.go @@ -57,7 +57,7 @@ func (u *SnapshotService) SnapshotImport(req dto.SnapshotImport) error { return fmt.Errorf("incorrect snapshot request body: %v", req.Names) } for _, snapName := range req.Names { - snap, _ := snapshotRepo.Get(commonRepo.WithByName(snapName)) + snap, _ := snapshotRepo.Get(commonRepo.WithByName(strings.ReplaceAll(snapName, ".tar.gz", ""))) if snap.ID != 0 { return constant.ErrRecordExist }