lib/resque/scheduler.rb in resque-scheduler-1.9.9 vs lib/resque/scheduler.rb in resque-scheduler-1.9.10
- old
+ new
@@ -9,11 +9,11 @@
class << self
# If true, logs more stuff...
attr_accessor :verbose
-
+
# If set, produces no output
attr_accessor :mute
# Schedule all jobs and continually look for delayed jobs (never returns)
def run
@@ -37,11 +37,11 @@
# poll/enqueing to finish (should be almost istant). In the
# case of sleeping, exit immediately.
def register_signal_handlers
trap("TERM") { shutdown }
trap("INT") { shutdown }
-
+
begin
trap('QUIT') { shutdown }
trap('USR1') { kill_child }
rescue ArgumentError
warn "Signals QUIT and USR1 not supported."
@@ -94,11 +94,11 @@
enqueue_delayed_items_for_timestamp(timestamp)
end
# continue processing until there are no more ready timestamps
end while !timestamp.nil?
end
-
+
# Enqueues all delayed jobs for a timestamp
def enqueue_delayed_items_for_timestamp(timestamp)
item = nil
begin
handle_shutdown do
@@ -138,10 +138,10 @@
if (job_klass = config['custom_job_class']) && (job_klass != 'Resque::Job')
# custom job classes not supporting the same API calls must implement the #schedule method
constantize(job_klass).scheduled(queue, klass_name, *params)
else
Resque::Job.create(queue, klass_name, *params)
- end
+ end
rescue
log! "Failed to enqueue #{klass_name}:\n #{$!}"
end
def rufus_scheduler