mirror of
https://github.com/Routstr/routstr-core.git
synced 2026-10-05 12:28:22 +00:00
fix: renew refund lease on the request session
This commit is contained in:
+2
-3
@@ -144,9 +144,8 @@ async def _close(
|
||||
return bool(result.rowcount)
|
||||
|
||||
|
||||
async def renew_lease(refund: Refund) -> None:
|
||||
async def renew_lease(session: AsyncSession, refund: Refund) -> None:
|
||||
"""Push the reconciler lease forward before a slow mint step."""
|
||||
async with create_session() as session:
|
||||
await session.exec( # type: ignore[call-overload]
|
||||
update(Refund)
|
||||
.where(col(Refund.id) == refund.id)
|
||||
@@ -349,7 +348,7 @@ async def _pay_lightning(session: AsyncSession, refund: Refund) -> bool:
|
||||
|
||||
async def _pay_cashu(session: AsyncSession, refund: Refund) -> bool:
|
||||
amount = amount_in_unit(refund.amount_msats, refund.unit)
|
||||
await renew_lease(refund)
|
||||
await renew_lease(session, refund)
|
||||
token = await send_token(amount, refund.unit, refund.mint_url)
|
||||
# From here the token is bearer money: keep it on the claim so a failed
|
||||
# settle withholds the balance instead of restoring it.
|
||||
|
||||
Reference in New Issue
Block a user