From ec50f2cccedd6582d1b15a6be224159821e57a98 Mon Sep 17 00:00:00 2001 From: Andras Banki-Horvath Date: Thu, 22 Apr 2021 15:31:17 +0200 Subject: [PATCH] invoices: more verbose logging for startup invoice GC --- invoices/invoiceregistry.go | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/invoices/invoiceregistry.go b/invoices/invoiceregistry.go index b73de5e5..5016c96c 100644 --- a/invoices/invoiceregistry.go +++ b/invoices/invoiceregistry.go @@ -213,8 +213,15 @@ func (i *InvoiceRegistry) scanInvoicesOnStart() error { len(pending)) i.expiryWatcher.AddInvoices(pending...) - if err := i.cdb.DeleteInvoice(removable); err != nil { - log.Warnf("Deleting old invoices failed: %v", err) + if len(removable) > 0 { + log.Infof("Attempting to delete %v canceled invoices", + len(removable)) + if err := i.cdb.DeleteInvoice(removable); err != nil { + log.Warnf("Deleting canceled invoices failed: %v", err) + } else { + log.Infof("Deleted %v canceled invoices", + len(removable)) + } } return nil