lib/roundabout/distributor.rb
#
# Merges given peers with existing ones returns a sorted array.
#
# Sorting is important as the array needs to be in the same order across all nodes.
#
# @param    [Array<Crawler>]   peers   {Crawler}s or RPC clients to them
#
# @return   [Array<Crawler>]   {Crawler}s or RPC clients to them
#
Merges given peers with existing ones returns a sorted array.
Sorting is important as the array needs to be in the same order across all nodes.
Merges given peers with existing ones returns a sorted array . Sorting is important as the array needs to be in the same order across all nodes .
def merge_peers( peers )
        crawlers = {}
        (@peers | peers).each { |p| crawlers[p.peer_url] = p }
        Hash[crawlers.sort].values
    end
def merge_peers ( peers ) crawlers = { } ( @peers | peers ) . each { | p | crawlers [ p . peer_url ] = p } Hash [ crawlers . sort ] . values end
Merges given peers with existing ones returns a sorted array.
Merges given peers with existing ones returns a sorted array .
{Crawler}s or RPC clients to them
{ Crawler } s or RPC clients to them
Array<Crawler>
peers
<not_specific>
<not_specific>
peers {Crawler}s or RPC clients to them
peers { Crawler } s or RPC clients to them