lib/ruote/exp/flowexpression.rb in ruote-2.1.1 vs lib/ruote/exp/flowexpression.rb in ruote-2.1.2
- old
+ new
@@ -249,20 +249,21 @@
ct.last[Ruote::FlowExpressionId.child_id(fei)] = ut
update_tree(ct)
end
h.children.delete(fei)
+ # accept without any check ?
if h.state != nil # failing or timing out ...
if h.children.size < 1
reply_to_parent(workitem)
else
persist_or_raise # for the updated h.children
end
- else
+ else # vanilla reply
reply(workitem)
end
end
@@ -280,18 +281,18 @@
# The raw handling of messages passed to expressions (the fine handling
# is done in the #cancel method).
#
def do_cancel (msg)
- @msg = Ruote.fulldup(msg)
-
return if h.state == 'cancelling'
# cancel on cancel gets discarded
+ @msg = Ruote.fulldup(msg)
+
flavour = msg['flavour']
- return if h.state == 'failed' and flavour == 'timeout'
+ return if h.state == 'failed' && flavour == 'timeout'
# do not timeout expressions that are "in error" (failed)
h.state = case flavour
when 'kill' then 'dying'
when 'timeout' then 'timing_out'
@@ -315,9 +316,12 @@
# This default implementation cancels all the [registered] children
# of this expression.
#
def cancel (flavour)
+
+ return reply_to_parent(h.applied_workitem) \
+ unless h.children.find { |cfei| Ruote::FlowExpression.fetch(cfei) }
do_persist || return
# before firing the cancel message to the children
h.children.each do |cfei|