Merge branch 'master' of ssh://github.com/micro/go-micro

This commit is contained in:
Asim Aslam 2020-01-03 19:46:24 +00:00
commit 649dd235c3
2 changed files with 14 additions and 7 deletions

View File

@ -533,8 +533,7 @@ func (h *httpBroker) Publish(topic string, msg *Message, opts ...PublishOption)
s, err := h.r.GetService(serviceName) s, err := h.r.GetService(serviceName)
if err != nil { if err != nil {
h.RUnlock() h.RUnlock()
// ignore error return err
return nil
} }
h.RUnlock() h.RUnlock()

View File

@ -99,6 +99,7 @@ func (t *Task) Run(c task.Command) error {
// subscribe for the pool size // subscribe for the pool size
for i := 0; i < t.Options.Pool; i++ { for i := 0; i < t.Options.Pool; i++ {
err := func() error {
// subscribe to work // subscribe to work
subWork, err := t.Broker.Subscribe(topic, workFn, broker.Queue(fmt.Sprintf("work.%d", i))) subWork, err := t.Broker.Subscribe(topic, workFn, broker.Queue(fmt.Sprintf("work.%d", i)))
if err != nil { if err != nil {
@ -107,6 +108,13 @@ func (t *Task) Run(c task.Command) error {
// unsubscribe on completion // unsubscribe on completion
defer subWork.Unsubscribe() defer subWork.Unsubscribe()
return nil
}()
if err != nil {
return err
}
} }
// subscribe to all status messages // subscribe to all status messages