lib/openwfe/expressions/timeout.rb in openwferu-0.9.10.653 vs lib/openwfe/expressions/timeout.rb in openwferu-0.9.11
- old
+ new
@@ -84,10 +84,19 @@
def reschedule (scheduler)
to_reschedule(scheduler)
end
#
+ # Combines a call to determine_timeout and to reschedule.
+ #
+ def schedule_timeout (timeout_attname=:timeout)
+
+ determine_timeout(timeout_attname)
+ to_reschedule(get_scheduler)
+ end
+
+ #
# Overrides the parent method to make sure a potential
# timeout schedules gets removed.
#
# Well... Leave that to classes that mix this in...
# No method override in a mixin...
@@ -116,24 +125,31 @@
#
# prefixed with "to_" for easy mix in
#
def to_reschedule (scheduler)
- return if @timeout_job_id
+ #return if @timeout_job_id
#
# already rescheduled
return unless @timeout_at
#
# no need for a timeout
- @timeout_job_id =
- scheduler.schedule_at(@timeout_at, self, :do_timeout!)
+ @timeout_job_id = "timeout_#{self.fei.to_s}"
+ scheduler.schedule_at(
+ @timeout_at,
+ { :schedulable => self,
+ :job_id => @timeout_job_id,
+ :do_timeout! => true })
+
ldebug do
- "to_reschedule() will timeout at "+
- "#{OpenWFE::to_iso8601_date(@timeout_at)}"
+ "to_reschedule() will timeout at " +
+ "#{OpenWFE::to_iso8601_date(@timeout_at)}" +
+ " @timeout_job_id is #{@timeout_job_id}" +
+ " (oid #{object_id})"
end
#store_itself()
#
# done in the including expression
@@ -144,10 +160,11 @@
#
def unschedule_timeout ()
ldebug do
"unschedule_timeout() " +
- "@timeout_job_id is #{@timeout_job_id}"
+ "@timeout_job_id is #{@timeout_job_id}" +
+ " (oid #{object_id})"
end
#ldebug_callstack "unschedule_timeout()"
get_scheduler.unschedule(@timeout_job_id) \