Skip to content
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

consumer: retry nsqlookupd queries #209

Merged
merged 3 commits into from
Jun 4, 2017
Merged
Changes from 1 commit
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
Next Next commit
consumer: retry next nsqlookupd query 2 times
mreiferson committed Jun 3, 2017
commit bb1fa75d84a1dcb8e5f3893d259c63e8377c0905
1 change: 0 additions & 1 deletion conn.go
Original file line number Diff line number Diff line change
@@ -487,7 +487,6 @@ func (c *Conn) readLoop() {
}

frameType, data, err := ReadUnpackedResponse(c)

if err != nil {
if err == io.EOF && atomic.LoadInt32(&c.closeFlag) == 1 {
goto exit
8 changes: 8 additions & 0 deletions consumer.go
Original file line number Diff line number Diff line change
@@ -454,6 +454,9 @@ type peerInfo struct {
//
// initiate a connection to any new producers that are identified.
func (r *Consumer) queryLookupd() {
retries := 0

retry:
endpoint := r.nextLookupdEndpoint()

r.log(LogLevelInfo, "querying nsqlookupd %s", endpoint)
@@ -462,6 +465,11 @@ func (r *Consumer) queryLookupd() {
err := apiRequestNegotiateV1("GET", endpoint, nil, &data)
if err != nil {
r.log(LogLevelError, "error querying nsqlookupd (%s) - %s", endpoint, err)
retries++
if retries < 3 {
r.log(LogLevelInfo, "retrying with next nsqlookupd")
goto retry
}
return
}