Sha256: c8c23f1633f6d36cd6bcab1763ec307bedfac6fcca44ca5986d129024bb31887
Contents?: true
Size: 624 Bytes
Versions: 30
Compression:
Stored size: 624 Bytes
Contents
require 'open-uri' module Dataset $dataset = [] LOCK = Mutex.new def self.start Thread.new do loop do $dataset.each do |url| print "Open #{url} " begin open(url) puts "SUCCESS" rescue => err puts "FAILURE #{err.message}" end sleep 1 end end end end def self.<<(url) if not $started $started = true start end LOCK.lock $dataset << url $dataset.uniq! LOCK.unlock end def self.rm(url) LOCK.lock $dataset.remove url LOCK.unlock end end
Version data entries
30 entries across 30 versions & 1 rubygems