mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-24 08:05:02 +01:00
PubSUb now uses buffered channels
This commit is contained in:
@@ -82,13 +82,11 @@ type WebhookInvoicePayload struct {
|
||||
}
|
||||
|
||||
func (svc *LndhubService) subscribeIncomingOutgoingInvoices() (incoming, outgoing chan models.Invoice, err error) {
|
||||
incomingInvoices := make(chan models.Invoice, DefaultChannelBufSize)
|
||||
outgoingInvoices := make(chan models.Invoice, DefaultChannelBufSize)
|
||||
_, err = svc.InvoicePubSub.Subscribe(common.InvoiceTypeIncoming, incomingInvoices)
|
||||
incomingInvoices, _, err := svc.InvoicePubSub.Subscribe(common.InvoiceTypeIncoming)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
_, err = svc.InvoicePubSub.Subscribe(common.InvoiceTypeOutgoing, outgoingInvoices)
|
||||
outgoingInvoices, _, err := svc.InvoicePubSub.Subscribe(common.InvoiceTypeOutgoing)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user