mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-19 12:01:12 +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 = "",
|
description: str = "",
|
||||||
conn: Optional[Connection] = None,
|
conn: Optional[Connection] = None,
|
||||||
) -> str:
|
) -> str:
|
||||||
async with (db.reuse_conn(conn) if conn else db.connect()) as conn:
|
|
||||||
temp_id = f"temp_{urlsafe_short_hash()}"
|
temp_id = f"temp_{urlsafe_short_hash()}"
|
||||||
internal_id = f"internal_{urlsafe_short_hash()}"
|
internal_id = f"internal_{urlsafe_short_hash()}"
|
||||||
|
|
||||||
@@ -160,6 +159,7 @@ async def pay_invoice(
|
|||||||
# actually pay the external invoice
|
# actually pay the external invoice
|
||||||
payment: PaymentResponse = await WALLET.pay_invoice(payment_request)
|
payment: PaymentResponse = await WALLET.pay_invoice(payment_request)
|
||||||
if payment.checking_id:
|
if payment.checking_id:
|
||||||
|
async with (db.reuse_conn(conn) if conn else db.connect()) as conn:
|
||||||
await create_payment(
|
await create_payment(
|
||||||
checking_id=payment.checking_id,
|
checking_id=payment.checking_id,
|
||||||
fee=payment.fee_msat,
|
fee=payment.fee_msat,
|
||||||
|
Reference in New Issue
Block a user