mirror of
https://github.com/lnbits/lnbits.git
synced 2025-09-22 15:57:28 +02:00
only check pending from the last 15 days.
This commit is contained in:
@@ -183,19 +183,23 @@ async def get_payments(
|
|||||||
pending: bool = False,
|
pending: bool = False,
|
||||||
outgoing: bool = False,
|
outgoing: bool = False,
|
||||||
incoming: bool = False,
|
incoming: bool = False,
|
||||||
|
since: Optional[int] = None,
|
||||||
exclude_uncheckable: bool = False,
|
exclude_uncheckable: bool = False,
|
||||||
) -> List[Payment]:
|
) -> List[Payment]:
|
||||||
"""
|
"""
|
||||||
Filters payments to be returned by complete | pending | outgoing | incoming.
|
Filters payments to be returned by complete | pending | outgoing | incoming.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
args: Any = ()
|
args: List[Any] = []
|
||||||
|
clause: List[str] = []
|
||||||
|
|
||||||
clause = []
|
if since != None:
|
||||||
|
clause.append("time > ?")
|
||||||
|
args.append(since)
|
||||||
|
|
||||||
if wallet_id:
|
if wallet_id:
|
||||||
clause.append("wallet = ?")
|
clause.append("wallet = ?")
|
||||||
args = (wallet_id,)
|
args.append(wallet_id)
|
||||||
|
|
||||||
if complete and pending:
|
if complete and pending:
|
||||||
pass
|
pass
|
||||||
@@ -230,7 +234,7 @@ async def get_payments(
|
|||||||
{where}
|
{where}
|
||||||
ORDER BY time DESC
|
ORDER BY time DESC
|
||||||
""",
|
""",
|
||||||
args,
|
tuple(args),
|
||||||
)
|
)
|
||||||
|
|
||||||
return [Payment.from_row(row) for row in rows]
|
return [Payment.from_row(row) for row in rows]
|
||||||
|
@@ -1,3 +1,4 @@
|
|||||||
|
import time
|
||||||
import trio # type: ignore
|
import trio # type: ignore
|
||||||
from http import HTTPStatus
|
from http import HTTPStatus
|
||||||
from typing import Optional, List, Callable
|
from typing import Optional, List, Callable
|
||||||
@@ -72,7 +73,10 @@ async def check_pending_payments():
|
|||||||
await delete_expired_invoices()
|
await delete_expired_invoices()
|
||||||
while True:
|
while True:
|
||||||
for payment in await get_payments(
|
for payment in await get_payments(
|
||||||
complete=False, pending=True, exclude_uncheckable=True
|
since=(int(time.time()) - 60 * 60 * 24 * 15), # 15 days ago
|
||||||
|
complete=False,
|
||||||
|
pending=True,
|
||||||
|
exclude_uncheckable=True,
|
||||||
):
|
):
|
||||||
print(" - checking pending", payment.checking_id)
|
print(" - checking pending", payment.checking_id)
|
||||||
await payment.check_pending()
|
await payment.check_pending()
|
||||||
|
Reference in New Issue
Block a user