lib/openwfe/expressions/fe_concurrence.rb in openwferu-0.9.10.653 vs lib/openwfe/expressions/fe_concurrence.rb in openwferu-0.9.11
- old
+ new
@@ -213,27 +213,32 @@
#
class ConcurrentIteratorExpression < ConcurrenceExpression
names :concurrent_iterator
- #attr_accessor :iterator
+ attr_accessor :template
def apply (workitem)
if @children.length < 1
reply_to_parent workitem
return
end
- template = @children[0]
+ @template = @children[0]
@children.clear
@workitems = []
iterator = Iterator.new(self, workitem)
+ if not iterator.has_next?
+ reply_to_parent workitem
+ return
+ end
+
while iterator.has_next?
wi = workitem.dup
@workitems << wi
@@ -244,12 +249,15 @@
self, iterator.index, template, vars)
@children << rawexp.fei
end
- get_expression_pool.remove(template)
+ super
+ end
+ def reply_to_parent (workitem)
+ get_expression_pool.remove(@template)
super
end
protected
@@ -367,11 +375,11 @@
protected
def do_reply (synchable, workitem)
synchable.ldebug do
- "#{self.class}.do_reply() from"+
+ "#{self.class}.do_reply() from " +
"#{workitem.last_expression_id.to_debug_s}"
end
@merge_array.push(synchable, workitem)
@@ -396,10 +404,11 @@
end
#
# over-if
- conditional = synchable.eval_condition("over-if", workitem)
+ conditional =
+ synchable.eval_condition("over-if", workitem, "over-unless")
if conditional
treat_remaining_children(synchable)
reply_to_parent(synchable)
return true