PubSUb now uses buffered channels

This commit is contained in:
Lucas Rouckhout
2023-02-18 15:25:46 +01:00
parent 4791251e77
commit 118297d79f
4 changed files with 11 additions and 14 deletions

View File

@@ -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
}