def polling_loop(connection)
      if polling?
        polling_msg = "Polling enabled. Checking every #{config.poll_interval} seconds."
      else
        polling_msg = "Polling disabled. Checking for messages once."
      end
      Mailman.logger.info(polling_msg)

      tries ||= 5
      loop do
        begin
          connection.connect
          connection.get_messages
        rescue SystemCallError, EOFError => e
          Mailman.logger.error e.message
          unless (tries -= 1).zero?
            Mailman.logger.error "Retrying..."
            begin
              connection.disconnect
            rescue # don't crash in the crash handler
            end
            retry
          end
        ensure
          connection.started? && connection.disconnect
        end

        break unless polling?
        sleep config.poll_interval
      end
    end
def polling_loop(connection)
      if polling?
        polling_msg = "Polling enabled. Checking every #{config.poll_interval} seconds."
      else
        polling_msg = "Polling disabled. Checking for messages once."
      end
      Mailman.logger.info(polling_msg)

      tries ||= 5
      loop do
        begin
          connection.connect
          connection.get_messages
        rescue SystemCallError, EOFError => e
          Mailman.logger.error e.message
          unless (tries -= 1).zero?
            Mailman.logger.error "Retrying..."
            begin
              connection.disconnect
            rescue # don't crash in the crash handler
            end
            retry
          end
        ensure
          connection.started? && connection.disconnect
        end

        break unless polling?
        sleep config.poll_interval
      end
    end
def polling_loop ( connection ) if polling? polling_msg = "Polling enabled. Checking every #{config.poll_interval} seconds." else polling_msg = "Polling disabled. Checking for messages once." end Mailman . logger . info ( polling_msg ) tries ||= 5 loop do begin connection . connect connection . get_messages rescue SystemCallError , EOFError => e Mailman . logger . error e . message unless ( tries -= 1 ) . zero? Mailman . logger . error "Retrying..." begin connection . disconnect rescue # don't crash in the crash handler end retry end ensure connection . started? && connection . disconnect end break unless polling? sleep config . poll_interval end end
Run the polling loop for the email inbox connection
Run the polling loop for the email inbox connection