Sha256: 2ecb54f196cc07c77300116e9fee8fa2adc14bac97a137e4492e6b57b4db25c5

Contents?: true

Size: 374 Bytes

Versions: 2

Compression:

Stored size: 374 Bytes

Contents

module MBidle
  class UniqueQueue < EM::Queue
    def push(*items)
      EM.schedule do
        items.each do |item|
          @sink.push(item) unless @sink.include?(item)
        end
        unless @popq.empty?
          @drain = @sink
          @sink = []
          @popq.shift.call @drain.shift until @drain.empty? || @popq.empty?
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mbidle-1.1.1 lib/mbidle/unique_queue.rb
mbidle-1.1.0 lib/mbidle/unique_queue.rb