From 9cb745132b554ec4dfcda96825bcd41e49633a81 Mon Sep 17 00:00:00 2001 From: Lucas Rouckhout Date: Mon, 6 Feb 2023 18:29:41 +0100 Subject: [PATCH] Adding some comments and inlining the init of bufPool --- lib/service/rabbitmq.go | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/lib/service/rabbitmq.go b/lib/service/rabbitmq.go index 3b3c940..fa0de4d 100644 --- a/lib/service/rabbitmq.go +++ b/lib/service/rabbitmq.go @@ -11,12 +11,8 @@ import ( amqp "github.com/rabbitmq/amqp091-go" ) -var bufPool sync.Pool - -func init() { - bufPool = sync.Pool{ - New: func() interface{} { return new(bytes.Buffer) }, - } +var bufPool sync.Pool = sync.Pool{ + New: func() interface{} { return new(bytes.Buffer) }, } func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error { @@ -33,7 +29,8 @@ func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error { defer ch.Close() err = ch.ExchangeDeclare( - //TODO: review exchange config + // TODO: review the whole exchange setup. For the time being we simply declare a single exchange and start pushing to it. + // Towards the future however this might become a more involved setup. svc.Config.RabbitMQInvoiceExchange, // topic is a type of exchange that allows routing messages to different queue's bases on a routing key "topic",