Skip to content

Commit

Permalink
Merge pull request #15 from ban11111/master
Browse files Browse the repository at this point in the history
fix bug, and add test
  • Loading branch information
Xib1uvXi authored Oct 17, 2019
2 parents 5498733 + 3b3b27d commit 4c9475f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions mq/nsq/receiver.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
10 changes: 10 additions & 0 deletions mq/nsq/receiver_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down

0 comments on commit 4c9475f

Please sign in to comment.