From: Brad Tilley Date: 2006-10-25T11:37:37+09:00 Subject: threads I'm rewriting some old Python scripts in Ruby. Just to learn a bit more. I want to thread this code to check websites concurrently. Could somone offer advice? What are reasonable limits on threads in Ruby? ips.each do |ip| begin Timeout::timeout(5) do Net::HTTP.start(ip) do |site| data = site.get( '/' ).body.downcase if data.include?(minolta) and data.include?(pagescope) puts printer + "\t" + ip elsif data.include?(xerox) and data.include?(printer) puts printer + "\t" + ip else puts "website\t" + ip end end end # Don't really care about exceptions just time outs mostly. rescue Timeout::Error puts "Timeout\t" + ip rescue Exception puts "General Exception\t" + ip end end -- Posted via http://www.ruby-forum.com/.