Method: Resque::Scheduler.run
- Defined in:
- lib/resque/scheduler.rb
.run ⇒ Object
Schedule all jobs and continually look for delayed jobs (never returns)
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/resque/scheduler.rb', line 35 def run procline 'Starting' # trap signals register_signal_handlers # Quote from the resque/worker. # Fix buffering so we can `rake resque:scheduler > scheduler.log` and # get output from the child in there. $stdout.sync = true $stderr.sync = true # Load the schedule into rufus # If dynamic is set, load that schedule otherwise use normal load if dynamic reload_schedule! else load_schedule! end begin @th = Thread.current # Now start the scheduling part of the loop. loop do if master? begin handle_delayed_items update_schedule if dynamic rescue Errno::EAGAIN, Errno::ECONNRESET => e log! e. end end poll_sleep end rescue Interrupt log 'Exiting' end end |