Skip to content

Commit

Permalink
Merge pull request nsqio#88 from mreiferson/debug_88
Browse files Browse the repository at this point in the history
consumer: fix discovery behavior delegate
  • Loading branch information
ploxiln committed Oct 26, 2014
2 parents 760d55a + d095a2a commit 2c41008
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions consumer.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import (
"sync"
"sync/atomic"
"time"

"github.com/bitly/go-simplejson"
)

// Handler is the message processing interface for Consumer
Expand Down Expand Up @@ -201,6 +199,7 @@ func (r *Consumer) SetBehaviorDelegate(cb interface{}) {
if !matched {
panic("behavior delegate does not have any recognized methods")
}

r.behaviorDelegate = cb
}

Expand Down Expand Up @@ -405,10 +404,9 @@ func (r *Consumer) queryLookupd() {
// ],
// "timestamp": 1340152173
// }
producersArray := data.Get("Producers").MustArray()
nsqdAddrs := make([]string, len(producersArray))
for _, element := range producersArray {
producer := element.(*simplejson.Json)
nsqdAddrs := make([]string, 0)
for i := range data.Get("producers").MustArray() {
producer := data.Get("producers").GetIndex(i)
broadcastAddress := producer.Get("broadcast_address").MustString()
port := producer.Get("tcp_port").MustInt()
joined := net.JoinHostPort(broadcastAddress, strconv.Itoa(port))
Expand Down

0 comments on commit 2c41008

Please sign in to comment.