lib/rufus/scheduler.rb in rufus-scheduler-3.5.1 vs lib/rufus/scheduler.rb in rufus-scheduler-3.5.2

- old
+ new

@@ -9,11 +9,11 @@ module Rufus class Scheduler - VERSION = '3.5.1' + VERSION = '3.5.2' EoTime = ::EtOrbi::EoTime require 'rufus/scheduler/util' require 'rufus/scheduler/jobs' @@ -613,39 +613,10 @@ when :cron CronJob end job = job_class.new(self, t, opts, block || callable) - - #fail ArgumentError.new( - # "job frequency (#{job.frequency}) is higher than " + - # "scheduler frequency (#{@frequency})" - #) if job.respond_to?(:frequency) && job.frequency < @frequency - # - # This was expensive - - if ( - ! job.is_a?(Rufus::Scheduler::IntervalJob) && - job.methods.include?(:next_time_from) - ) then - - nts = (1..365) - .inject([ job.send(:next_time_from, EtOrbi.now) ]) { |a, i| - a << job.send(:next_time_from, a.last); a } - deltas = []; prev = nts.shift - while (nt = nts.shift); deltas << (nt - prev).to_f; prev = nt; end - - deltas = deltas[1..-1] \ - if opts.keys.find { |k| k.to_s.match(/\Afirst/) } - # - # do not consider the first delta if there is a first, first_at, - # or first_in involved - - fail ArgumentError.new( - "job frequency (~max #{deltas.min}s) is higher than " + - "scheduler frequency (#{@frequency})" - ) if deltas.min < @frequency * 0.9 - end + job.check_frequency @jobs.push(job) return_job_instance ? job : job.job_id end