Fix: tasks.py reuse db connection for invoice deletion (#971)
* check if wallet exists * check wallet existence in key check * reuse db connection for payment deletion
This commit is contained in:
parent
6f9ad06449
commit
232d50baaa
1 changed files with 3 additions and 3 deletions
|
|
@ -174,7 +174,7 @@ class Payment(BaseModel):
|
||||||
logger.warning(
|
logger.warning(
|
||||||
f"Deleting outgoing failed payment {self.checking_id}: {status}"
|
f"Deleting outgoing failed payment {self.checking_id}: {status}"
|
||||||
)
|
)
|
||||||
await self.delete()
|
await self.delete(conn)
|
||||||
elif not status.pending:
|
elif not status.pending:
|
||||||
logger.info(
|
logger.info(
|
||||||
f"Marking '{'in' if self.is_in else 'out'}' {self.checking_id} as not pending anymore: {status}"
|
f"Marking '{'in' if self.is_in else 'out'}' {self.checking_id} as not pending anymore: {status}"
|
||||||
|
|
@ -182,10 +182,10 @@ class Payment(BaseModel):
|
||||||
await self.update_status(status, conn=conn)
|
await self.update_status(status, conn=conn)
|
||||||
return status
|
return status
|
||||||
|
|
||||||
async def delete(self) -> None:
|
async def delete(self, conn: Optional[Connection] = None) -> None:
|
||||||
from .crud import delete_payment
|
from .crud import delete_payment
|
||||||
|
|
||||||
await delete_payment(self.checking_id)
|
await delete_payment(self.checking_id, conn=conn)
|
||||||
|
|
||||||
|
|
||||||
class BalanceCheck(BaseModel):
|
class BalanceCheck(BaseModel):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue