Tracking cron jobs.
(mostly synchronizing access to the map of cron jobs)
Public class methods
new
()
[show source]
# File lib/rufus/sc/jobqueues.rb, line 120 120: def initialize 121: 122: @mutex = Mutex.new 123: @jobs = {} 124: end
Public instance methods
<<
(job)
[show source]
# File lib/rufus/sc/jobqueues.rb, line 139 139: def << (job) 140: 141: @mutex.synchronize { @jobs[job.job_id] = job } 142: end
size
()
[show source]
# File lib/rufus/sc/jobqueues.rb, line 144 144: def size 145: 146: @jobs.size 147: end
to_h
()
[show source]
# File lib/rufus/sc/jobqueues.rb, line 149 149: def to_h 150: 151: @jobs.dup 152: end
trigger_matching_jobs
(now)
[show source]
# File lib/rufus/sc/jobqueues.rb, line 131 131: def trigger_matching_jobs (now) 132: 133: js = @mutex.synchronize { @jobs.values } 134: # maybe this sync is a bit paranoid 135: 136: js.each { |job| job.trigger_if_matches(now) } 137: end
unschedule
(job_id)
[show source]
# File lib/rufus/sc/jobqueues.rb, line 126 126: def unschedule (job_id) 127: 128: @mutex.synchronize { @jobs.delete(job_id) } 129: end