From 2e0eaca0eec64698ad3450b3e86198bff2aad42f Mon Sep 17 00:00:00 2001 From: Willem van Bergen Date: Fri, 10 Apr 2015 12:59:22 -0400 Subject: [PATCH] Update to latest master --- client.go | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/client.go b/client.go index ad869690f..a9e152556 100644 --- a/client.go +++ b/client.go @@ -1,7 +1,6 @@ package sarama import ( - "fmt" "sort" "sync" "time" @@ -347,13 +346,9 @@ func (client *client) RefreshCoordinator(consumerGroup string) error { return err } - coordinator := &Broker{ - id: response.CoordinatorID, - addr: fmt.Sprintf("%s:%d", response.CoordinatorHost, response.CoordinatorPort), - } - client.lock.Lock() - client.coordinators[consumerGroup] = client.registerBroker(coordinator).ID() + client.registerBroker(response.Coordinator) + client.coordinators[consumerGroup] = response.Coordinator.ID() client.lock.Unlock() return nil @@ -364,7 +359,7 @@ func (client *client) RefreshCoordinator(consumerGroup string) error { // registerBroker makes sure a broker received by a Metadata or Coordinator request is registered // in the brokers map. It returns the broker that is registered, which may be the provided broker, // or a previously registered Broker instance. -func (client *client) registerBroker(broker *Broker) *Broker { +func (client *client) registerBroker(broker *Broker) { if client.brokers[broker.ID()] == nil { client.brokers[broker.ID()] = broker Logger.Printf("client/brokers Registered new broker #%d at %s", broker.ID(), broker.Addr()) @@ -373,7 +368,6 @@ func (client *client) registerBroker(broker *Broker) *Broker { client.brokers[broker.ID()] = broker Logger.Printf("client/brokers Replaced registered broker #%d with %s", broker.ID(), broker.Addr()) } - return client.brokers[broker.ID()] } // deregisterBroker removes a broker from the seedsBroker list, and if it's