lib/openwfe/expressions/time.rb in openwferu-0.9.10.653 vs lib/openwfe/expressions/time.rb in openwferu-0.9.11
- old
+ new
@@ -68,39 +68,21 @@
ldebug { "cancel()..." }
unschedule()
- return super()
+ super()
end
end
def unschedule ()
ldebug { "unschedule() @scheduler_job_id is #{@scheduler_job_id}" }
get_scheduler.unschedule(@scheduler_job_id) \
if @scheduler_job_id
end
-
- protected
-
- #
- # Will return true if this TimeExpression has a
- # 'scheduler_job_ib' and this job is this expression's job.
- #
- # The job_id is specifiable, so that this method can also be
- # used by the 'when' expression for example.
- #
- def already_scheduled? (job_id=nil)
-
- job_id = @scheduler_job_id unless job_id
-
- s = get_scheduler.get_schedulable job_id
-
- return (s and s.fei == self.fei)
- end
end
#
# A parent class for WhenExpression and WaitExpression.
#
@@ -144,11 +126,11 @@
determine_timeout()
store_itself()
- trigger(nil)
+ trigger()
end
def reply (workitem)
result = workitem.get_result
@@ -163,33 +145,34 @@
def cancel ()
to_unschedule()
super()
end
- def trigger (params)
+ def trigger (params={})
ldebug { "trigger() #{@fei.to_debug_s} params is #{params}" }
- if params == :do_timeout!
+ if params[:do_timeout!]
#
# do timeout...
#
- set_timedout_flag(@applied_workitem)
- reply_to_parent(@applied_workitem)
+ set_timedout_flag @applied_workitem
+ reply_to_parent @applied_workitem
return
end
@scheduler_job_id = nil
evaluate_condition()
end
def reschedule (scheduler)
- #return unless @applied_workitem
+ @scheduler_job_id = "waiting_#{fei.to_s}"
- @scheduler_job_id =
- scheduler.schedule_in(@frequency, self, nil)
+ scheduler.schedule_in(
+ @frequency,
+ { :schedulable => self, :job_id => @scheduler_job_id })
ldebug { "reschedule() @scheduler_job_id is #{@scheduler_job_id}" }
to_reschedule(scheduler)
end