lib/resque/worker.rb in resque-1.24.0 vs lib/resque/worker.rb in resque-1.24.1

- old
+ new

@@ -1,5 +1,7 @@ +require 'time' + module Resque # A Resque Worker processes jobs. On platforms that support fork(2), # the worker will fork off a child to process each job. This ensures # a clean slate when beginning the next job and cuts down on gradual # memory growth as well as low level failures. @@ -221,11 +223,11 @@ rescue Exception => e log "Error reserving job: #{e.inspect}" log e.backtrace.join("\n") raise e end - + # Reconnect to Redis to avoid sharing a connection with the parent, # retry up to 3 times with increasing delay before giving up. def reconnect tries = 0 begin @@ -532,11 +534,11 @@ # Boolean - true if idle, false if not def idle? state == :idle end - + def will_fork? !@cant_fork && !$TESTING && (ENV["FORK_PER_JOB"] != 'false') end # Returns a symbol representing the current worker state, @@ -625,10 +627,10 @@ end def log!(message) debug(message) end - + # Deprecated legacy methods for controlling the logging threshhold # Use Resque.logger.level now, e.g.: # # Resque.logger.level = Logger::DEBUG #