From eba4eb850f0ecfb5839395aa125955ceaa2a454f Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期四, 19 十月 2023 16:39:07 +0800 Subject: [PATCH] Merge branch 'feat-serf' --- pkg/nsqclient/consumer.go | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/nsqclient/consumer.go b/pkg/nsqclient/consumer.go index a0df0b0..6e377b2 100644 --- a/pkg/nsqclient/consumer.go +++ b/pkg/nsqclient/consumer.go @@ -1,6 +1,7 @@ package nsqclient import ( + "apsClient/pkg/logx" "context" "fmt" "time" @@ -18,7 +19,7 @@ channel string } -func NewNsqConsumer(ctx context.Context, topic, channel string, options ...func(*nsq.Config)) (*NsqConsumer, error) { +func NewNsqConsumer(topic, channel string, options ...func(*nsq.Config)) (*NsqConsumer, error) { conf := nsq.NewConfig() conf.MaxAttempts = 0 conf.MsgTimeout = 10 * time.Minute // 榛樿涓�涓秷鎭渶澶氳兘澶勭悊鍗佸垎閽燂紝鍚﹀垯灏变細閲嶆柊涓㈠叆闃熷垪 @@ -33,7 +34,6 @@ } return &NsqConsumer{ consumer: consumer, - ctx: ctx, topic: topic, channel: channel, }, nil @@ -90,9 +90,9 @@ for { select { case <-n.ctx.Done(): - fmt.Println("[%s] %s,%s", "stop consumer", n.topic, n.channel) + logx.Infof("[%s]%s stop consumer...", n.topic, n.channel) n.consumer.Stop() - fmt.Println("[%s] %s,%s", "stop consumer success", n.topic, n.channel) + logx.Infof("[%s]%s stop consumer success", n.topic, n.channel) return nil } } -- Gitblit v1.8.0