fix coroutine await
This commit is contained in:
parent
e1b31ea064
commit
5c0fa0df83
1 changed files with 2 additions and 2 deletions
4
crud.py
4
crud.py
|
|
@ -145,12 +145,12 @@ async def tracked_spend_nwc(
|
||||||
in_budget = True
|
in_budget = True
|
||||||
for budget in budgets:
|
for budget in budgets:
|
||||||
last_cycle, next_cycle = budget.get_timestamp_range()
|
last_cycle, next_cycle = budget.get_timestamp_range()
|
||||||
tot_spent_in_range_msats = await db.fetchone(
|
tot_spent_in_range_msats =(await db.fetchone(
|
||||||
"""
|
"""
|
||||||
SELECT SUM(amount_msats) FROM nwcprovider.spent WHERE pubkey = ? AND created_at >= ? AND created_at < ?
|
SELECT SUM(amount_msats) FROM nwcprovider.spent WHERE pubkey = ? AND created_at >= ? AND created_at < ?
|
||||||
""",
|
""",
|
||||||
(pubkey, last_cycle, next_cycle)
|
(pubkey, last_cycle, next_cycle)
|
||||||
)[0] or 0
|
))[0] or 0
|
||||||
if tot_spent_in_range_msats + amount_msats > budget.budget_msats:
|
if tot_spent_in_range_msats + amount_msats > budget.budget_msats:
|
||||||
in_budget = False
|
in_budget = False
|
||||||
break
|
break
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue