Skip to content

Support the more flattened HTTP response, supporting nsq v1+ #35

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Support the more flattened HTTP response, supporting nsq v1+
  • Loading branch information
abourget committed Feb 13, 2019
commit 87b2c58d9c328e703a152f7d4c9b0e3c39846238
12 changes: 4 additions & 8 deletions lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,22 +52,18 @@ func (c *LookupClient) Lookup(topic string) (result LookupResult, err error) {
producers := make(map[producerInfoKey]ProducerInfo)

for _, r := range retList {
v := struct {
StatusCode int `json:"status_code"`
StatusTxt string `json:"status_txt"`
Data LookupResult `json:"data"`
}{}
var lookupResult LookupResult

if e := json.Unmarshal(r, &v); e != nil {
if e := json.Unmarshal(r, &lookupResult); e != nil {
err = appendError(err, e)
continue
}

for _, c := range v.Data.Channels {
for _, c := range lookupResult.Channels {
channels[c] = true
}

for _, p := range v.Data.Producers {
for _, p := range lookupResult.Producers {
producers[producerInfoKey{
BroadcastAddress: p.BroadcastAddress,
Hostname: p.Hostname,
Expand Down