lib/quebert/worker.rb
# Start the worker backend and intercept exceptions if a handler is provided
Start the worker backend and intercept exceptions if a handler is provided
Start the worker backend and intercept exceptions if a handler is provided
def start
      Signal.trap('TERM') { safe_stop }
      Signal.trap('INT') { safe_stop }
      logger.info "Worker started with #{backend.class.name} backend\n"
      backend.queues = queues if backend.respond_to?(:queues=)
      while @controller = backend.reserve do
        begin
          @controller.perform
        rescue => error
          if exception_handler
            exception_handler.call(
              error,
              :controller => @controller,
              :pid => $$,
              :worker => self
            )
          else
            raise
          end
        end
        @controller = nil
        stop if @terminate_sent
      end
    end
def start Signal . trap ( 'TERM' ) { safe_stop } Signal . trap ( 'INT' ) { safe_stop } logger . info "Worker started with #{backend.class.name} backend\n" backend . queues = queues if backend . respond_to? ( :queues= ) while @controller = backend . reserve do begin @controller . perform rescue => error if exception_handler exception_handler . call ( error , :controller => @controller , :pid => $$ , :worker => self ) else raise end end @controller = nil stop if @terminate_sent end end
Start the worker backend and intercept exceptions if a handler is provided
Start the worker backend and intercept exceptions if a handler is provided