Reactor: fix wrong match on reactivation in propagation rule

A propagaition rule must ignore reactivated occurrence.
Although it is possible that other occurrences are waiting,
and they can be erroneously selected if precautions are not taken.
This commit is contained in:
Fedor Isakov 2021-05-04 11:06:19 +02:00
parent 5e4dfb249e
commit 16e0fdf9dd
1 changed files with 7 additions and 1 deletions

View File

@ -423,7 +423,13 @@ internal class ReteRuleMatcherImpl(private var ruleLookup: RuleLookup?,
val reactivated = layers.any { it.containsOccurrence(occurrence) }
// propagation history
if (propagation && reactivated) return nextGeneration().reset()
if (propagation && reactivated) {
// TODO: need a better way to process occurrences that are activated but ignored
// TODO: introduce a flag on ReteNode?
// TODO: same concerns "unique signatures" and "consumed signatures"
lastIntroduced = occurrence
return nextGeneration().reset()
}
var firstAffected = -1
for ((idx, layer) in layers.withIndex()) {