mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-21 14:10:30 +02:00
prevent pay_invoice from locking sqlite for the entire app.
This commit is contained in:
@@ -85,7 +85,6 @@ async def pay_invoice(
|
||||
description: str = "",
|
||||
conn: Optional[Connection] = None,
|
||||
) -> str:
|
||||
async with (db.reuse_conn(conn) if conn else db.connect()) as conn:
|
||||
temp_id = f"temp_{urlsafe_short_hash()}"
|
||||
internal_id = f"internal_{urlsafe_short_hash()}"
|
||||
|
||||
@@ -160,6 +159,7 @@ async def pay_invoice(
|
||||
# actually pay the external invoice
|
||||
payment: PaymentResponse = await WALLET.pay_invoice(payment_request)
|
||||
if payment.checking_id:
|
||||
async with (db.reuse_conn(conn) if conn else db.connect()) as conn:
|
||||
await create_payment(
|
||||
checking_id=payment.checking_id,
|
||||
fee=payment.fee_msat,
|
||||
|
Reference in New Issue
Block a user