lib/email_crawler.rb in email_crawler-0.1.0 vs lib/email_crawler.rb in email_crawler-0.1.1
- old
+ new
@@ -29,10 +29,10 @@
urls.each { |url| logger.info "#{url}" }
queue = Thread::Queue.new
urls.each { |url| queue.push(url) }
links_by_url = ThreadSafe::Array.new
- threads = (1..[urls.length, @max_concurrency].min).map do |i|
+ threads = (1..[queue.size, @max_concurrency].min).map do |i|
Thread.new(i) do |i|
url = begin
queue.pop(true)
rescue ThreadError; end