class Rufus::Scheduler::CronJobQueue
Tracking cron jobs.
Public Class Methods
new()
click to toggle source
Calls superclass method
Rufus::Scheduler::JobQueue.new
# File lib/rufus/sc/jobqueues.rb, line 129 def initialize super @last_cron_second = nil end
Public Instance Methods
<<(job)
click to toggle source
# File lib/rufus/sc/jobqueues.rb, line 149 def << (job) @mutex.synchronize do delete(job.job_id) @jobs << job end end
trigger_matching_jobs()
click to toggle source
# File lib/rufus/sc/jobqueues.rb, line 135 def trigger_matching_jobs now = Time.now return if now.sec == @last_cron_second @last_cron_second = now.sec # # ensuring the crons are checked within 1 second (not 1.2 second) jobs = @mutex.synchronize { @jobs.dup } jobs.each { |job| job.trigger_if_matches(now) } end