nsqio / go-nsq

The official Go package for NSQ
MIT License
2.59k stars 444 forks source link

Check nsqlookupd list emptiness on Consumer instantiation #314

Closed borodiychuk closed 3 years ago

borodiychuk commented 3 years ago

If empty nsqlookupd servers list is ConnectToNSQLookupds is provided, then Consumer instantiation does not fail, which is confusing. This PR makes it return an error for such case.

ploxiln commented 3 years ago

It is a somewhat common pattern to sometimes call this with an empty list, as part of allowing either nsqd-tcp-address or lookupd-http-address lists:

https://github.com/nsqio/nsq/blob/master/apps/nsq_tail/nsq_tail.go#L124

https://github.com/nsqio/nsq/blob/master/apps/nsq_to_http/nsq_to_http.go#L289

borodiychuk commented 3 years ago

Oh, I see, it makes sense, yes.

ploxiln commented 3 years ago

It's reasonable to question :)