def reply_to_parent (workitem, delete=true)
if h.tagname
unset_variable(h.tagname)
@context.storage.put_msg(
'left_tag', 'tag' => h.tagname, 'fei' => h.fei)
end
if h.timeout_schedule_id && h.state != 'timing_out'
@context.storage.delete_schedule(h.timeout_schedule_id)
end
if h.state == 'failing'
trigger('on_error', workitem)
elsif (h.state == 'cancelling') and h.on_cancel
trigger('on_cancel', workitem)
elsif (h.state == 'timing_out') and h.on_timeout
trigger('on_timeout', workitem)
else
if delete
do_unpersist || return
end
if h.parent_id
@context.storage.put_msg(
'reply',
'fei' => h.parent_id,
'workitem' => workitem.merge!('fei' => h.fei),
'updated_tree' => h.updated_tree)
else
@context.storage.put_msg(
h.forgotten ? 'ceased' : 'terminated',
'wfid' => h.fei['wfid'],
'fei' => h.fei,
'workitem' => workitem)
end
end
end