Skip to content

Commit d62a44b

Browse files
committed
聚合服务相关日志
1 parent 969bb2b commit d62a44b

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

internal/rpc/services/service_node_log.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"github.com/TeaOSLab/EdgeAPI/internal/db/models"
66
rpcutils "github.com/TeaOSLab/EdgeAPI/internal/rpc/utils"
77
"github.com/TeaOSLab/EdgeCommon/pkg/rpc/pb"
8+
"github.com/iwind/TeaGo/lists"
89
"github.com/iwind/TeaGo/types"
910
)
1011

@@ -61,8 +62,18 @@ func (this *NodeLogService) ListNodeLogs(ctx context.Context, req *pb.ListNodeLo
6162
return nil, err
6263
}
6364

65+
hashList := []string{}
66+
6467
result := []*pb.NodeLog{}
6568
for _, log := range logs {
69+
// 如果是需要修复的日志,我们需要去重
70+
if req.FixedState > 0 {
71+
if lists.ContainsString(hashList, log.Hash) {
72+
continue
73+
}
74+
hashList = append(hashList, log.Hash)
75+
}
76+
6677
result = append(result, &pb.NodeLog{
6778
Id: int64(log.Id),
6879
Role: log.Role,

0 commit comments

Comments
 (0)