diff --git a/consumer.go b/consumer.go index 4242ad33..77e1a7ff 100644 --- a/consumer.go +++ b/consumer.go @@ -15,6 +15,8 @@ import ( "sync" "sync/atomic" "time" + + "github.com/bitly/go-simplejson" ) // Handler is the message processing interface for Consumer @@ -405,8 +407,8 @@ func (r *Consumer) queryLookupd() { // } producersArray := data.Get("Producers").MustArray() nsqdAddrs := make([]string, len(producersArray)) - for i := range producersArray { - producer := data.Get("Producers").GetIndex(i) + for _, element := range producersArray { + producer := element.(*simplejson.Json) broadcastAddress := producer.Get("broadcast_address").MustString() port := producer.Get("tcp_port").MustInt() joined := net.JoinHostPort(broadcastAddress, strconv.Itoa(port))