[优化] 规则实体影响的处理时间

This commit is contained in:
PandaX
2023-10-31 13:06:57 +08:00
parent 199fd40676
commit f8322ef3b8
3 changed files with 42 additions and 28 deletions

View File

@@ -11,13 +11,13 @@ import (
var ruleChainDebugData = message.NewRuleChainDebugData(100)
type ruleChainInstance struct {
type RuleChainInstance struct {
ruleId string
firstRuleNodeId string
nodes map[string]nodes.Node
}
func NewRuleChainInstance(ruleId string, data []byte) (*ruleChainInstance, []error) {
func NewRuleChainInstance(ruleId string, data []byte) (*RuleChainInstance, []error) {
errors := make([]error, 0)
manifest, err := manifest.New(data)
@@ -35,14 +35,14 @@ func NewRuleChainInstance(ruleId string, data []byte) (*ruleChainInstance, []err
}
// newWithManifest create rule chain by user's manifest file
func newInstanceWithManifest(m *manifest.Manifest) (*ruleChainInstance, []error) {
func newInstanceWithManifest(m *manifest.Manifest) (*RuleChainInstance, []error) {
errs := make([]error, 0)
nodes, err := nodes.GetNodes(m)
if err != nil {
errs = append(errs, err)
return nil, errs
}
r := &ruleChainInstance{
r := &RuleChainInstance{
firstRuleNodeId: m.FirstRuleNodeId,
nodes: nodes,
}
@@ -50,7 +50,7 @@ func newInstanceWithManifest(m *manifest.Manifest) (*ruleChainInstance, []error)
}
// StartRuleChain TODO 是否需要添加context
func (c *ruleChainInstance) StartRuleChain(context context.Context, message *message.Message) error {
func (c *RuleChainInstance) StartRuleChain(context context.Context, message *message.Message) error {
// 处理debug的通道消息
go func() {
for {