lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.5.0 vs lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.5.1

- old
+ new

@@ -277,10 +277,13 @@ def start_work_thread thread = Thread.new do + Thread.current[:rufus_scheduler_job] = true + # indicates that the thread is going to be assigned immediately + Thread.current[@scheduler.thread_key] = true Thread.current[:rufus_scheduler_work_thread] = true loop do @@ -318,16 +321,16 @@ def trigger_queue(time) threads = @scheduler.work_threads - cur = threads.size vac = threads.select { |t| t[:rufus_scheduler_job] == nil }.size - #min = @scheduler.min_work_threads - max = @scheduler.max_work_threads que = @scheduler.work_queue.size + cur = threads.size + max = @scheduler.max_work_threads + start_work_thread if vac - que < 1 && cur < max @scheduler.work_queue << [ self, time ] end end @@ -613,14 +616,9 @@ super(scheduler, cronline, opts, block) @cron_line = opts[:_t] || ::Fugit::Cron.parse(cronline) set_next_time(nil) - end - - def frequency - - @cron_line.frequency end def brute_frequency @cron_line.brute_frequency