prevent pay_invoice from locking sqlite for the entire app.
This commit is contained in:
parent
e9b9197641
commit
0331861cc6
1 changed files with 72 additions and 72 deletions
|
|
@ -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,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue