lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.0.1 vs lib/rufus/scheduler/jobs.rb in rufus-scheduler-3.0.2
- old
+ new
@@ -80,12 +80,10 @@
end
@scheduled_at = Time.now
@unscheduled_at = nil
@last_time = nil
- #@mutexes = {}
- #@pool_mutex = Mutex.new
@locals = {}
@local_mutex = Mutex.new
@id = determine_id
@@ -288,18 +286,18 @@
# sets this information
end
def do_trigger_in_thread(time)
- #@pool_mutex.synchronize do
+ threads = @scheduler.work_threads
- count = @scheduler.work_threads.size
- #vacant = threads.select { |t| t[:rufus_scheduler_job] == nil }.size
+ 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
- start_work_thread if count < max
- #end
+ start_work_thread if vac - que < 1 && cur < max
@scheduler.work_queue << [ self, time ]
end
end