Просмотр исходного кода

fix(rule): change rule state if exit by error

Fix the problem start is not executed if rule is stopped by error

Signed-off-by: Jiyong Huang <huangjy@emqx.io>
Jiyong Huang 2 лет назад
Родитель
Сommit
2bc447ec10
1 измененных файлов с 7 добавлено и 3 удалено
  1. 7 3
      internal/topo/rule/ruleState.go

+ 7 - 3
internal/topo/rule/ruleState.go

@@ -199,10 +199,14 @@ func (rs *RuleState) runTopo(ctx context.Context) {
 	if err != nil { // Exit after retries
 		rs.Lock()
 		// The only change the state by error
-		rs.triggered = 0
-		if rs.Topology != nil {
-			rs.topoGraph = rs.Topology.GetTopo()
+		if rs.triggered != -1 {
+			rs.triggered = 0
+			if rs.Topology != nil {
+				rs.topoGraph = rs.Topology.GetTopo()
+			}
+			rs.ActionCh <- ActionSignalStop
 		}
+
 		rs.Unlock()
 	}
 }