def process_msgs

      @msgs = @storage.get_msgs if @msgs.empty?

      collisions = 0

      while @msg = @msgs.shift

        r = process(@msg)

        if r != false
          @processed_msgs += 1
        else
          collisions += 1
        end

        if collisions > 2
          @msgs = @msgs[(@msgs.size / 2)..-1] || []
          collisions = 0
        end

        break if Time.now.utc - @last_time >= 0.8
      end
    end
def process_msgs

      @msgs = @storage.get_msgs if @msgs.empty?

      collisions = 0

      while @msg = @msgs.shift

        r = process(@msg)

        if r != false
          @processed_msgs += 1
        else
          collisions += 1
        end

        if collisions > 2
          @msgs = @msgs[(@msgs.size / 2)..-1] || []
          collisions = 0
        end

        break if Time.now.utc - @last_time >= 0.8
      end
    end
Gets msgs from the storage (if needed) and processes them one by one.