Method: Archipelago::Client::Base#update_services!
- Defined in:
- lib/archipelago/client.rb
#update_services!(options = {}) ⇒ Object
Make our @jockey lookup all our services.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
# File 'lib/archipelago/client.rb', line 105 def update_services!( = {}) timeout = [:timeout] || 0 silent = [:silent] || false validate = [:validate] || false around_update_services do @service_descriptions.each do |name, description| # # This sure sounds inefficient, but hey, listen up: # # * RBTrees are nice and fast when it comes to looking up ordered stuff. # * They are horribly slow in all other ways. # * As an example: It takes (as of this writing) 10x the time to insert 10k elements in an RBTree # as it takes to sort 10k elements in an Array. # # This means that using them in Archipelago::Disco::ServiceLocker will be inefficient as hell, since they # are merging and creating new maps all the time. But in here, I expect us to not renew our service lists # more than on average once every MAXIMUM_SERVICE_UPDATE_INTERVAL, so that MAY make it worthwhile to do # the RBTree song and dance in here. Hopefully. # new_services = @jockey.lookup(Archipelago::Disco::Query.new(description), :timeout => timeout, :silent => silent) new_services.convert_to_tree! new_services.validate! if validate @services[name] = new_services @debug_callable.call("#{self}.service[#{name.inspect}]: #{PP.pp(@services[name].keys, "")}") if @debug_callable end end end |