diff --git a/lib/service/rabbitmq.go b/lib/service/rabbitmq.go index f2eb2a9..4c4866c 100644 --- a/lib/service/rabbitmq.go +++ b/lib/service/rabbitmq.go @@ -19,12 +19,12 @@ func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error { // It is recommended that, when possible, publishers and consumers // use separate connections so that consumers are isolated from potential // flow control messures that may be applied to publishing connections. - // We therefore start a single publishing connection here. + // We therefore start a single publishing connection here instead of storing + // one on the service object. conn, err := amqp.Dial(svc.Config.RabbitMQUri) if err != nil { return err } - svc.RabbitMqConn = conn ch, err := conn.Channel() if err != nil { diff --git a/lib/service/service.go b/lib/service/service.go index 72e02e5..06b3238 100644 --- a/lib/service/service.go +++ b/lib/service/service.go @@ -12,8 +12,6 @@ import ( "github.com/uptrace/bun" "github.com/ziflex/lecho/v3" "golang.org/x/crypto/bcrypt" - - amqp "github.com/rabbitmq/amqp091-go" ) const alphaNumBytes = random.Alphanumeric @@ -25,7 +23,6 @@ type LndhubService struct { Logger *lecho.Logger IdentityPubkey string InvoicePubSub *Pubsub - RabbitMqConn *amqp.Connection } func (svc *LndhubService) GenerateToken(ctx context.Context, login, password, inRefreshToken string) (accessToken, refreshToken string, err error) {