Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@rtecco
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save rtecco/9945119 to your computer and use it in GitHub Desktop.
Save rtecco/9945119 to your computer and use it in GitHub Desktop.
weird thing
/*
For readersCount == 4, you might see 4 "added reader" (0 through 3) or just one, or three, etc. Like it's blocking somewhere... The readers that do initialize process messages just fine. All of the nsqlookupd hosts respond to /ping.
*/
for i := 0; i < readersCount; i++ {
r, err := nsq.NewReader(topic, channel)
if err != nil {
log.Fatalln("nsq.NewReader:", err)
}
r.SetMaxInFlight(2500)
for j := 0; j < workersPerReader; j++ {
r.AddHandler(w)
}
for _, host := range hosts {
err := r.ConnectToLookupd(host)
if err != nil {
log.Fatalf("ConnectToLookupd @ %s: %s\n", host, err)
}
}
fmt.Println("added reader", i)
readers[i] = r
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment