From 2f62d98299a0408d79fc7623c35f1e47b910bc0a Mon Sep 17 00:00:00 2001 From: calle <93376500+callebtc@users.noreply.github.com> Date: Sun, 26 Jun 2022 19:12:55 +0200 Subject: [PATCH] Delete expired invoices after one pending check (#531) * delete expired invoices regularly and after pending check * fix mistake * delete expired invoices only once --- lnbits/tasks.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lnbits/tasks.py b/lnbits/tasks.py index 34f37a394..c5c3279f9 100644 --- a/lnbits/tasks.py +++ b/lnbits/tasks.py @@ -82,8 +82,6 @@ async def invoice_listener(): async def check_pending_payments(): - await delete_expired_invoices() - outgoing = True incoming = True @@ -98,6 +96,9 @@ async def check_pending_payments(): ): await payment.check_pending() + # we delete expired invoices once upon the first pending check + if incoming: + await delete_expired_invoices() # after the first check we will only check outgoing, not incoming # that will be handled by the global invoice listeners, hopefully incoming = False