mirror of
https://github.com/aljazceru/nutshell.git
synced 2025-12-24 03:54:21 +01:00
Cjbeery24/mint copy: Invoice checker background tasks (#722)
* #616: Removed blocking call from ledger startup. Instead added it to a background task that repeats every hour. * make task interval configurable, remember task and cancel it on shutdown * comments * add sleep to tests because the background task is async --------- Co-authored-by: Caleb Beery <cjbeery@gmail.com>
This commit is contained in:
@@ -178,6 +178,9 @@ async def test_startup_fakewallet_pending_quote_success(ledger: Ledger):
|
||||
# run startup routinge
|
||||
await ledger.startup_ledger()
|
||||
|
||||
# we need to sleep because the startup routine for checking the invoices is async
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# expect that no pending tokens are in db anymore
|
||||
melt_quotes = await ledger.crud.get_all_melt_quotes_from_pending_proofs(
|
||||
db=ledger.db
|
||||
@@ -204,6 +207,9 @@ async def test_startup_fakewallet_pending_quote_failure(ledger: Ledger):
|
||||
# run startup routinge
|
||||
await ledger.startup_ledger()
|
||||
|
||||
# we need to sleep because the startup routine for checking the invoices is async
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# expect that no pending tokens are in db anymore
|
||||
melt_quotes = await ledger.crud.get_all_melt_quotes_from_pending_proofs(
|
||||
db=ledger.db
|
||||
@@ -225,6 +231,9 @@ async def test_startup_fakewallet_pending_quote_pending(ledger: Ledger):
|
||||
# run startup routinge
|
||||
await ledger.startup_ledger()
|
||||
|
||||
# we need to sleep because the startup routine for checking the invoices is async
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# expect that melt quote is still pending
|
||||
melt_quotes = await ledger.crud.get_all_melt_quotes_from_pending_proofs(
|
||||
db=ledger.db
|
||||
@@ -247,6 +256,9 @@ async def test_startup_fakewallet_pending_quote_unknown(ledger: Ledger):
|
||||
# run startup routinge
|
||||
await ledger.startup_ledger()
|
||||
|
||||
# we need to sleep because the startup routine for checking the invoices is async
|
||||
await asyncio.sleep(1)
|
||||
|
||||
# expect that melt quote is still pending
|
||||
melt_quotes = await ledger.crud.get_all_melt_quotes_from_pending_proofs(
|
||||
db=ledger.db
|
||||
|
||||
Reference in New Issue
Block a user