invoices: fix synchronization issue with single invoice subscribers

This commit fixes a synchronization issue where a single invoice
subscriber could receive duplicate and/or out of order invoice updates.
This commit is contained in:
Joost Jager committed 2019-08-13 19:02:55 +02:00
1 parent 9ab23de197
commit 395e0596c2
3 files changed
+73 -42

No files matched your search

+4 -1
View File
@@ -178,7 +178,10 @@ func (s *Server) SubscribeSingleInvoice(req *SubscribeSingleInvoiceRequest,
return err
}
invoiceClient := s.cfg.InvoiceRegistry.SubscribeSingleInvoice(hash)
invoiceClient, err := s.cfg.InvoiceRegistry.SubscribeSingleInvoice(hash)
if err != nil {
return err
}
defer invoiceClient.Cancel()
for {