add other taskgroup for non-start-important tasks
This commit is contained in:
parent
a08cbf412d
commit
2893f1eb9e
1 changed files with 4 additions and 1 deletions
|
@ -154,6 +154,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
|
|
||||||
self._tx_cache = pylru.lrucache(100000)
|
self._tx_cache = pylru.lrucache(100000)
|
||||||
self._update_tasks = TaskGroup()
|
self._update_tasks = TaskGroup()
|
||||||
|
self._other_tasks = TaskGroup() # that we dont need to start
|
||||||
self._utxo_reservation_lock = asyncio.Lock()
|
self._utxo_reservation_lock = asyncio.Lock()
|
||||||
self._header_processing_lock = asyncio.Lock()
|
self._header_processing_lock = asyncio.Lock()
|
||||||
self._address_update_locks: DefaultDict[str, asyncio.Lock] = defaultdict(asyncio.Lock)
|
self._address_update_locks: DefaultDict[str, asyncio.Lock] = defaultdict(asyncio.Lock)
|
||||||
|
@ -335,7 +336,9 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
|
|
||||||
async def stop(self):
|
async def stop(self):
|
||||||
self._update_tasks.cancel()
|
self._update_tasks.cancel()
|
||||||
|
self._other_tasks.cancel()
|
||||||
await self._update_tasks.done.wait()
|
await self._update_tasks.done.wait()
|
||||||
|
await self._other_tasks.done.wait()
|
||||||
await self.network.stop()
|
await self.network.stop()
|
||||||
await self.db.close()
|
await self.db.close()
|
||||||
await self.headers.close()
|
await self.headers.close()
|
||||||
|
@ -352,7 +355,7 @@ class Ledger(metaclass=LedgerRegistry):
|
||||||
async with self._header_processing_lock:
|
async with self._header_processing_lock:
|
||||||
for height in reversed(sorted(self.headers.known_missing_checkpointed_chunks)):
|
for height in reversed(sorted(self.headers.known_missing_checkpointed_chunks)):
|
||||||
await self.headers.ensure_chunk_at(height)
|
await self.headers.ensure_chunk_at(height)
|
||||||
self._update_tasks.add(doit())
|
self._other_tasks.add(doit())
|
||||||
await self.update_headers()
|
await self.update_headers()
|
||||||
|
|
||||||
async def update_headers(self, height=None, headers=None, subscription_update=False):
|
async def update_headers(self, height=None, headers=None, subscription_update=False):
|
||||||
|
|
Loading…
Reference in a new issue