lib/rufus/sc/jobs.rb in rufus-scheduler-2.0.22 vs lib/rufus/sc/jobs.rb in rufus-scheduler-2.0.23

- old
+ new

@@ -184,10 +184,23 @@ "rufus_scheduler__trigger_thread__#{@scheduler.object_id}" ] = self @last_job_thread = job_thread + # note that add_job and add_cron_job ensured that :blocking is + # not used along :timeout + + if to = @params[:timeout] + + to_job = @scheduler.in(to, :parent => self, :tags => 'timeout') do + + if job_thread && job_thread.alive? + job_thread.raise(Rufus::Scheduler::TimeOutError) + end + end + end + begin trigger_block job_thread[ @@ -204,23 +217,9 @@ end @running = false end - # note that add_job and add_cron_job ensured that :blocking is - # not used along :timeout - - if to = @params[:timeout] - - to_job = @scheduler.in(to, :parent => self, :tags => 'timeout') do - - # at this point, @job_thread might be set - - if job_thread && job_thread.alive? - job_thread.raise(Rufus::Scheduler::TimeOutError) - end - end - end end # Simply encapsulating the block#call/trigger operation, for easy # override. #