From fca30bb394132fe310ba7b20219c9b9b7cf9036d Mon Sep 17 00:00:00 2001 From: wagslane Date: Tue, 7 Dec 2021 08:33:11 -0700 Subject: [PATCH] use defaults in consumer --- channel.go | 2 +- consume.go | 5 +---- examples/consumer/.gitignore | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 examples/consumer/.gitignore diff --git a/channel.go b/channel.go index 6b93f47..13f69bb 100644 --- a/channel.go +++ b/channel.go @@ -46,7 +46,7 @@ func getNewChannel(url string, conf amqp.Config) (*amqp.Connection, *amqp.Channe if err != nil { return nil, nil, err } - return amqpConn, ch, err + return amqpConn, ch, nil } // startNotifyCancelOrClosed listens on the channel's cancelled and closed diff --git a/consume.go b/consume.go index 467d5f6..c8b9c75 100644 --- a/consume.go +++ b/consume.go @@ -90,13 +90,10 @@ func (consumer Consumer) StartConsuming( optionFuncs ...func(*ConsumeOptions), ) error { defaultOptions := getDefaultConsumeOptions() - options := &ConsumeOptions{} + options := &defaultOptions for _, optionFunc := range optionFuncs { optionFunc(options) } - if options.Concurrency < 1 { - options.Concurrency = defaultOptions.Concurrency - } err := consumer.startGoroutines( handler, diff --git a/examples/consumer/.gitignore b/examples/consumer/.gitignore new file mode 100644 index 0000000..318292a --- /dev/null +++ b/examples/consumer/.gitignore @@ -0,0 +1 @@ +consumer