lib/openwfe/expressions/fe_when.rb in openwferu-0.9.10.653 vs lib/openwfe/expressions/fe_when.rb in openwferu-0.9.11
- old
+ new
@@ -73,16 +73,28 @@
#
# The 'when' expression by defaults, evaluates every 10 seconds its
# condition clause.
# A different frequency can be stated via the "frequency" attribute :
#
- # when :test => "${completion_level} == 4", :frequency => "1s"
+ # _when :test => "${completion_level} == 4", :frequency => "1s"
# participant "next_stage"
# end
#
# will check for the completion_level value every second. The scheduler
# itself is by default 'waking up' every 250 ms, so setting a frequency to
# something smaller than that value might prove useless.
+ # (Note than in the Ruby process definition, the 'when' got escaped to
+ # '_when' not to conflict with the 'when' keyword of the Ruby language).
+ #
+ # The when expression understands the 'timeout' attribute like the
+ # participant expression does. Thus
+ #
+ # _when :test => "${cows} == 'do fly'", :timeout => "1y"
+ # participant "me"
+ # end
+ #
+ # will timeout after one year (participant "me" will not receive a
+ # workitem).
#
class WhenExpression < WaitingExpression
names :when
conditions :test