Sha256: 52198123f522f8725436e97dcdac92f85cfdf11304a26e69647c6f13d7a463f3

Contents?: true

Size: 378 Bytes

Versions: 3

Compression:

Stored size: 378 Bytes

Contents

module Dryad
  module Cluster
    class ServiceObserver < ::Dryad::Consul::ServiceObserver
      def initialize(round_robin)
        @round_robin = round_robin
      end

      def update_self(service_instances)
        sis = service_instances.sort {|a, b| "#{a.address}:#{a.port}" <=> "#{b.address}:#{b.port}"}
        @round_robin.set_services(sis)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dryad-cluster-1.1.0 lib/dryad/cluster/service_observer.rb
dryad-cluster-1.0.1 lib/dryad/cluster/service_observer.rb
dryad-cluster-1.0.0 lib/dryad/cluster/service_observer.rb