From d6228713dbb3d1d58fe76372ab80ba76cc7a4a58 Mon Sep 17 00:00:00 2001 From: Olivia Golden Date: Thu, 16 May 2024 17:08:52 -0500 Subject: [PATCH] err check --- rules/engine.go | 5 ++++- v3enginetest/main.go | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/rules/engine.go b/rules/engine.go index 3f3dd69..f5c2bbe 100644 --- a/rules/engine.go +++ b/rules/engine.go @@ -268,7 +268,10 @@ func (e *v3Engine) AddPolling(namespacePattern string, preconditions DynamicRule lease: e.cl, engine: e, } - e.AddRule(rule, "/rule_locks"+namespacePattern+"lock", cbw.doRule, RuleID(namespacePattern)) + err = e.AddRule(rule, "/rule_locks"+namespacePattern+"lock", cbw.doRule, RuleID(namespacePattern)) + if err != nil { + return err + } return nil } diff --git a/v3enginetest/main.go b/v3enginetest/main.go index 2781800..285f66e 100644 --- a/v3enginetest/main.go +++ b/v3enginetest/main.go @@ -170,12 +170,13 @@ func main() { doneFalse := "false" doneRule, err := rules.NewEqualsLiteralRule(donePath, &doneFalse) check(err) - engine.AddRule(doneRule, "/rulesEngineDone/:id", func(task *rules.V3RuleTask) { + err = engine.AddRule(doneRule, "/rulesEngineDone/:id", func(task *rules.V3RuleTask) { path := task.Attr.Format(donePath) doneTrue := "true" _, err := kv.Put(task.Context, path, doneTrue) check(err) }, rules.RuleID(doneRuleID)) + check(err) engine.Run() time.Sleep(time.Second)