[fix] 规则链解析失败

This commit is contained in:
PandaX
2023-10-30 09:26:01 +08:00
parent 3811401667
commit 036e3c32b7
5 changed files with 16 additions and 10 deletions

View File

@@ -22,12 +22,14 @@ func GetDebugDataPage(page, pageSize int, ruleId, nodeId string) (int64, []messa
}
offset := pageSize * (page - 1)
if data, ok := ruleChainDebugData.Data[ruleId]; ok {
total := len(data.Get(nodeId).Items)
end := offset + pageSize
if end >= total {
end = total - 1
if data.Get(nodeId) != nil {
total := len(data.Get(nodeId).Items)
end := offset + pageSize
if end >= total {
end = total - 1
}
return int64(total), data.Get(nodeId).Items[offset:end]
}
return int64(total), data.Get(nodeId).Items[offset:end]
}
return 0, nil
}

View File

@@ -119,7 +119,7 @@ func (d *NodeDebugData) Clear(nodeId string) {
// DebugData 调试数据
// OnDebug 回调函数提供的数据
type DebugData struct {
Ts string
Ts string `json:"ts"`
NodeId string `json:"nodeId"`
MsgId string `json:"msgId"`
DebugType string `json:"debugType"` // In or Out