Skip to content

Commit baf5faf

Browse files
committed
fix(memqueue): Dont automaticaly start consumer
1 parent 2956d04 commit baf5faf

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

memqueue/queue.go

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,21 @@ type Queue struct {
8888
var _ taskq.Queue = (*Queue)(nil)
8989

9090
func NewQueue(opt *taskq.QueueOptions) *Queue {
91+
return NewQueueMaybeConsumer(true, opt)
92+
}
93+
94+
func NewQueueMaybeConsumer(startConsumer bool, opt *taskq.QueueOptions) *Queue {
9195
opt.Init()
9296

9397
q := &Queue{
9498
opt: opt,
9599
}
96100

97101
q.consumer = taskq.NewConsumer(q)
98-
if err := q.consumer.Start(context.Background()); err != nil {
99-
panic(err)
102+
if startConsumer {
103+
if err := q.consumer.Start(context.Background()); err != nil {
104+
panic(err)
105+
}
100106
}
101107

102108
return q

0 commit comments

Comments
 (0)