We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c256bfd commit 7c63240Copy full SHA for 7c63240
nsq/nsq.go
@@ -74,6 +74,7 @@ func WithMaxInFlight(num int) Option {
74
75
// NewWorker for struc
76
func NewWorker(opts ...Option) *Worker {
77
+ var err error
78
w := &Worker{
79
addr: "127.0.0.1:4150",
80
topic: "gorush",
@@ -92,17 +93,15 @@ func NewWorker(opts ...Option) *Worker {
92
93
94
cfg := nsq.NewConfig()
95
cfg.MaxInFlight = w.maxInFlight
- q, err := nsq.NewConsumer(w.topic, w.channel, cfg)
96
+ w.q, err = nsq.NewConsumer(w.topic, w.channel, cfg)
97
if err != nil {
98
panic(err)
99
}
- w.q = q
100
101
- p, err := nsq.NewProducer(w.addr, cfg)
+ w.p, err = nsq.NewProducer(w.addr, cfg)
102
103
104
105
- w.p = p
106
107
return w
108
0 commit comments