diff --git a/mq/nsq/receiver.go b/mq/nsq/receiver.go index d29579f..620265c 100644 --- a/mq/nsq/receiver.go +++ b/mq/nsq/receiver.go @@ -109,6 +109,7 @@ func (task *NsqTask) run() { if task.Fatal != nil { panic(task.Fatal) } + task.ConErr = nil for _, url := range task.host.Lookup { if err := task.consumer.ConnectToNSQLookupd(url); err != nil { diff --git a/mq/nsq/receiver_manager_test.go b/mq/nsq/receiver_manager_test.go index 12c3bc2..2b327fd 100644 --- a/mq/nsq/receiver_manager_test.go +++ b/mq/nsq/receiver_manager_test.go @@ -16,6 +16,16 @@ func TestReceiverManager(t *testing.T) { select {} } +func TestReceiverManagerNoLookup(t *testing.T) { + t.Skip("no run this test") + SetLogLv(nsq.LogLevelError) + receiver := NewNsqReceiver(&MqHostConfigs{Nsq: []string{"127.0.0.1:4150", "127.0.0.1:4152"}}) + manager := NewReceiverManager(receiver) + manager.Add(GenTask("Topic", "Channel")) + manager.Start() + select {} +} + func GenTask(topic, channel string) NsqHandlerFunc { return func() (config *MqTaskConfigs) { return &MqTaskConfigs{