stop doing the check_invoices thing on each call. do it once on lnbits starup and then rely on the invoices listener.

This commit is contained in:
fiatjaf
2021-03-21 17:57:33 -03:00
parent f27c2ebc21
commit 7e4a42e7ff
8 changed files with 61 additions and 70 deletions
-12
View File
@@ -13,7 +13,6 @@ from lnbits.decorators import api_check_wallet_key, api_validate_post_request
from .. import core_app, db
from ..services import create_invoice, pay_invoice, perform_lnurlauth
from ..crud import delete_expired_invoices
from ..tasks import sse_listeners
@@ -32,17 +31,6 @@ async def api_wallet():
)
@core_app.route("/api/v1/checkpending", methods=["POST"])
@api_check_wallet_key("invoice")
async def api_checkpending():
g.nursery.start_soon(delete_expired_invoices)
for payment in await g.wallet.get_payments(complete=False, pending=True, exclude_uncheckable=True):
await payment.check_pending()
return "", HTTPStatus.NO_CONTENT
@core_app.route("/api/v1/payments", methods=["GET"])
@api_check_wallet_key("invoice")
async def api_payments():