mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-23 15:44:51 +01:00
Adding some comments and inlining the init of bufPool
This commit is contained in:
@@ -11,13 +11,9 @@ import (
|
|||||||
amqp "github.com/rabbitmq/amqp091-go"
|
amqp "github.com/rabbitmq/amqp091-go"
|
||||||
)
|
)
|
||||||
|
|
||||||
var bufPool sync.Pool
|
var bufPool sync.Pool = sync.Pool{
|
||||||
|
|
||||||
func init() {
|
|
||||||
bufPool = sync.Pool{
|
|
||||||
New: func() interface{} { return new(bytes.Buffer) },
|
New: func() interface{} { return new(bytes.Buffer) },
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error {
|
func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error {
|
||||||
conn, err := amqp.Dial(svc.Config.RabbitMQUri)
|
conn, err := amqp.Dial(svc.Config.RabbitMQUri)
|
||||||
@@ -33,7 +29,8 @@ func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error {
|
|||||||
defer ch.Close()
|
defer ch.Close()
|
||||||
|
|
||||||
err = ch.ExchangeDeclare(
|
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,
|
svc.Config.RabbitMQInvoiceExchange,
|
||||||
// topic is a type of exchange that allows routing messages to different queue's bases on a routing key
|
// topic is a type of exchange that allows routing messages to different queue's bases on a routing key
|
||||||
"topic",
|
"topic",
|
||||||
|
|||||||
Reference in New Issue
Block a user