Sha256: 43c0a4b9b1fb40bbadbbf1219b522d80b710a399bf59d1acb52f06523b94d3fd

Contents?: true

Size: 510 Bytes

Versions: 4

Compression:

Stored size: 510 Bytes

Contents

require 'rubygems'
require 'mixpanel'
require 'open-uri'

require 'thread'

class Mixpanel::Subprocess
  Q = Queue.new
  ENDMARKER = Object.new

  Thread.abort_on_exception = true
  producer = Thread.new do 
    STDIN.each_line() do |url|
      STDERR.puts("Dropped: #{url}") && next if Q.length > 10000
      Q << url
    end
    Q << ENDMARKER
  end

  loop do
    url = Q.pop
    break if(url == ENDMARKER)
    url.chomp!
    next if(url.empty?) #for testing
  
    open(url).read
  end
  producer.join
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
mixpanel-0.8.1 lib/mixpanel/mixpanel_subprocess.rb
mixpanel-0.8.0 lib/mixpanel/mixpanel_subprocess.rb
loganb-mixpanel-0.7.2 lib/mixpanel/mixpanel_subprocess.rb
loganb-mixpanel-0.7.1 lib/mixpanel/mixpanel_subprocess.rb