mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-23 07:35:04 +01:00
Remove rabbit conn from service object
This commit is contained in:
@@ -19,12 +19,12 @@ func (svc *LndhubService) StartRabbitMqPublisher(ctx context.Context) error {
|
|||||||
// It is recommended that, when possible, publishers and consumers
|
// It is recommended that, when possible, publishers and consumers
|
||||||
// use separate connections so that consumers are isolated from potential
|
// use separate connections so that consumers are isolated from potential
|
||||||
// flow control messures that may be applied to publishing connections.
|
// 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)
|
conn, err := amqp.Dial(svc.Config.RabbitMQUri)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
svc.RabbitMqConn = conn
|
|
||||||
|
|
||||||
ch, err := conn.Channel()
|
ch, err := conn.Channel()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -12,8 +12,6 @@ import (
|
|||||||
"github.com/uptrace/bun"
|
"github.com/uptrace/bun"
|
||||||
"github.com/ziflex/lecho/v3"
|
"github.com/ziflex/lecho/v3"
|
||||||
"golang.org/x/crypto/bcrypt"
|
"golang.org/x/crypto/bcrypt"
|
||||||
|
|
||||||
amqp "github.com/rabbitmq/amqp091-go"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const alphaNumBytes = random.Alphanumeric
|
const alphaNumBytes = random.Alphanumeric
|
||||||
@@ -25,7 +23,6 @@ type LndhubService struct {
|
|||||||
Logger *lecho.Logger
|
Logger *lecho.Logger
|
||||||
IdentityPubkey string
|
IdentityPubkey string
|
||||||
InvoicePubSub *Pubsub
|
InvoicePubSub *Pubsub
|
||||||
RabbitMqConn *amqp.Connection
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (svc *LndhubService) GenerateToken(ctx context.Context, login, password, inRefreshToken string) (accessToken, refreshToken string, err error) {
|
func (svc *LndhubService) GenerateToken(ctx context.Context, login, password, inRefreshToken string) (accessToken, refreshToken string, err error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user