lib/roundabout/distributor.rb
#
# Distributes the paths to the peers
#
# @param    [Array<String]  urls    to distribute
#
Distributes the paths to the peers
Distributes the paths to the peers
def distribute( urls )
        tries = 5
        routed = {}
        urls.each { |url| (routed[route( url )] ||= []) << url }
        routed.each do |peer, r_urls|
            begin
                peer.push( r_urls ){}
            rescue Exception
                tries -= 1
                retry if tries > 0
            end
        end
        true
    end
def distribute ( urls ) tries = 5 routed = { } urls . each { | url | ( routed [ route ( url ) ] ||= [ ] ) << url } routed . each do | peer , r_urls | begin peer . push ( r_urls ) { } rescue Exception tries -= 1 retry if tries > 0 end end true end
Distributes the paths to the peers
Distributes the paths to the peers
urls
<not_specific>
<not_specific>
urls to distribute
urls to distribute