forked from LBRYCommunity/lbry-sdk
simplify accumulate task
This commit is contained in:
parent
7c4eb416d6
commit
d024433d1b
1 changed files with 1 additions and 4 deletions
|
@ -199,13 +199,10 @@ class Node:
|
||||||
async def _accumulate_search_junction(self, search_queue: asyncio.Queue,
|
async def _accumulate_search_junction(self, search_queue: asyncio.Queue,
|
||||||
result_queue: asyncio.Queue):
|
result_queue: asyncio.Queue):
|
||||||
tasks = []
|
tasks = []
|
||||||
async def __start_producing_task():
|
try:
|
||||||
while True:
|
while True:
|
||||||
blob_hash = await search_queue.get()
|
blob_hash = await search_queue.get()
|
||||||
tasks.append(asyncio.create_task(self._value_producer(blob_hash, result_queue)))
|
tasks.append(asyncio.create_task(self._value_producer(blob_hash, result_queue)))
|
||||||
tasks.append(asyncio.create_task(__start_producing_task()))
|
|
||||||
try:
|
|
||||||
await asyncio.wait(tasks)
|
|
||||||
finally:
|
finally:
|
||||||
for task in tasks:
|
for task in tasks:
|
||||||
task.cancel()
|
task.cancel()
|
||||||
|
|
Loading…
Reference in a new issue