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: ability to disconnect from nsqd #91

Merged
merged 1 commit into from
Nov 6, 2014

Conversation

mreiferson
Copy link
Member

this adds a function that allows the end-user to remove
addresses from the list of nsqd for situations where
they're not using nsqlookupd and instead maintaining
their own list.

@@ -477,8 +483,6 @@ func (r *Consumer) ConnectToNSQD(addr string) error {
conn.Close()
}

r.pendingConnections[addr] = true
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could have separated these commits better, but this was racey and needed to be moved into the critical section inside the lock.

@mreiferson
Copy link
Member Author

I'm going to add mirroring functionality to remove nsqlookupd addrs... so hold off on review unless it's a high-level concern.

mreiferson referenced this pull request in hailocab/go-nsq Nov 2, 2014
@mreiferson
Copy link
Member Author

RFR @jehiah


idx := indexOf(addr, r.nsqdTCPAddrs)
if idx == -1 {
return errors.New(fmt.Sprintf("unknown nsqd TCP address %s", addr))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mixed feelings as to weather or not this should error since we don't expose the list of where you are connected to. We don't typically expose named errors, but perhaps this would be a fair spot for return NotConnectedError.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NotConnectedError seems good to me

@mreiferson
Copy link
Member Author

updated

@jehiah
Copy link
Member

jehiah commented Nov 6, 2014

same for DisconnectFromNSQLookupd ?

@jehiah
Copy link
Member

jehiah commented Nov 6, 2014

looks good; squash beyond that

@mreiferson
Copy link
Member Author

Yes, they're consistent now

@mreiferson
Copy link
Member Author

🔨

jehiah added a commit that referenced this pull request Nov 6, 2014
consumer: ability to disconnect from nsqd
@jehiah jehiah merged commit 68ce738 into nsqio:master Nov 6, 2014
@mreiferson mreiferson deleted the remove_addrs_91 branch November 7, 2014 14:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants