def prepare
      if ENV['BACKGROUND']
        Process.daemon(true)
      end

      if ENV['PIDFILE']
        File.open(ENV['PIDFILE'], 'w') { |f| f << pid }
      end

      self.reconnect if ENV['BACKGROUND']
    end
def prepare
      if ENV['BACKGROUND']
        Process.daemon(true)
      end

      if ENV['PIDFILE']
        File.open(ENV['PIDFILE'], 'w') { |f| f << pid }
      end

      self.reconnect if ENV['BACKGROUND']
    end
Workers should be initialized with an array of string queue
 names. The order is important: a Worker will check the first
 queue given for a job. If none is found, it will check the
 second queue name given. If a job is found, it will be
 processed. Upon completion, the Worker will again check the
 first queue given, and so forth. In this way the queue list
 passed to a Worker on startup defines the priorities of queues.

 If passed a single "*", this Worker will operate on all queues
 in alphabetical order. Queues can be dynamically added or
 removed without needing to restart workers using this method.

 Workers should have `#prepare` called after they are initialized
 if you are running work on the worker.
 Daemonizes the worker if ENV['BACKGROUND'] is set and writes
 the process id to ENV['PIDFILE'] if set. Should only be called
 once per worker.