Skip to content

Commit

Permalink
Dont automaticaly start consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
rymurr authored Nov 27, 2024
1 parent 2956d04 commit 7b06835
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions memqueue/queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,21 @@ type Queue struct {
var _ taskq.Queue = (*Queue)(nil)

func NewQueue(opt *taskq.QueueOptions) *Queue {
return NewQueueMaybeConsumer(true, opt)
}

func NewQueueMaybeConsumer(startConsumer bool, opt *taskq.QueueOptions) *Queue
opt.Init()

Check failure on line 95 in memqueue/queue.go

View workflow job for this annotation

GitHub Actions / lint

expected declaration, found opt (typecheck)

Check failure on line 95 in memqueue/queue.go

View workflow job for this annotation

GitHub Actions / build (1.16.x)

syntax error: non-declaration statement outside function body

Check failure on line 95 in memqueue/queue.go

View workflow job for this annotation

GitHub Actions / build (1.17.x)

syntax error: non-declaration statement outside function body

q := &Queue{
opt: opt,
}

q.consumer = taskq.NewConsumer(q)
if err := q.consumer.Start(context.Background()); err != nil {
panic(err)
if startConsumer {
if err := q.consumer.Start(context.Background()); err != nil {
panic(err)
}
}

return q
Expand Down

0 comments on commit 7b06835

Please sign in to comment.