You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When I read go-nsq source code,I found AddConcurrentHandlers will panic after connecting to NSQD or NSQ Lookupd
Can someone explain why it is so designed?
thx
The text was updated successfully, but these errors were encountered:
It is just trying to enforce a strict order: add handlers, connect. Connect methods will also fail if no handlers were added first. (That aspect is probably more important, you probably want to ensure a goroutine is already waiting on the unbuffered incomingMessages channel before the conn tries to send on it.)
I guess it panics instead of just returning an error, because a correctly written program will definitely never get this error, so callers may be in the habit of not checking for the error. If starting over again I think we would not do it this way, but there's not a big-enough benefit to changing now.
ok, enforce a strict order is simple and clear. I just think that in some scenarios we may need to dynamically modify the ConcurrentHandlers at runtime to manage consumer concurrent processing power, but maybe there's not a big-enough benefit.
When I read go-nsq source code,I found AddConcurrentHandlers will panic after connecting to NSQD or NSQ Lookupd
Can someone explain why it is so designed?
thx
The text was updated successfully, but these errors were encountered: