simplify utils.archive.extract_async and stop ignoring the size_limit kwarg

Getting the initial generator in an executor is misguided since it does not actually begin executing until primed
This commit is contained in:
Io Mintz 2019-10-10 00:28:49 +00:00
parent 97947e61c1
commit f6d9cea805
1 changed files with 1 additions and 2 deletions

View File

@ -70,8 +70,7 @@ def extract_tar(archive, *, size_limit=None):
yield ArchiveInfo(member.name, content=tar.extractfile(member).read(), error=None)
async def extract_async(archive: typing.io.BinaryIO, size_limit=None):
gen = await asyncio.get_event_loop().run_in_executor(None, extract, archive)
for x in gen:
for x in extract(archive, size_limit=size_limit):
yield await asyncio.sleep(0, x)
def main():