def run
      Thread.current.name = format('rocketjob %03i', id)
      logger.info 'Started'
      until shutdown?
        wait = RocketJob::Config.instance.max_poll_seconds
        if process_available_jobs
          # Keeps workers staggered across the poll interval so that
          # all workers don't poll at the same time
          wait = rand(wait * 1000) / 1000
        end
        break if wait_for_shutdown?(wait)
      end
      logger.info 'Stopping'
    rescue Exception => exc
      logger.fatal('Unhandled exception in job processing thread', exc)
    ensure
      ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
    end
def run
      Thread.current.name = format('rocketjob %03i', id)
      logger.info 'Started'
      until shutdown?
        wait = RocketJob::Config.instance.max_poll_seconds
        if process_available_jobs
          # Keeps workers staggered across the poll interval so that
          # all workers don't poll at the same time
          wait = rand(wait * 1000) / 1000
        end
        break if wait_for_shutdown?(wait)
      end
      logger.info 'Stopping'
    rescue Exception => exc
      logger.fatal('Unhandled exception in job processing thread', exc)
    ensure
      ActiveRecord::Base.clear_active_connections! if defined?(ActiveRecord::Base)
    end
Process jobs until it shuts down

 Params
   worker_id [Integer]
     The number of this worker for logging purposes