vxgmichel / aiostream

Generator-based operators for asynchronous iteration
http://aiostream.readthedocs.io
GNU General Public License v3.0
797 stars 34 forks source link

Task exception was never retrieved warning #71

Closed cstruct closed 3 years ago

cstruct commented 3 years ago

When using merge and two tasks fail in the same tick a Task exception was never retrieved warning is generated.

I would expect both or none of case_1 and case_2 to emit the warning.

async def delayed_failing_async_iterator(delay):
    await asyncio.sleep(delay)
    raise Exception()
    yield

async def case_1():
    async with aiostream.stream.merge(
            delayed_failing_async_iterator(1),
            delayed_failing_async_iterator(1),
    ).stream() as streams:
        async for item in streams:
            pass

async def case_2():
    async with aiostream.stream.merge(
            delayed_failing_async_iterator(1),
            delayed_failing_async_iterator(2),
    ).stream() as streams:
        async for item in streams:
            pass
vxgmichel commented 3 years ago

Good catch! Thanks for the report and the PR :)

vxgmichel commented 3 years ago

Merged! @cstruct Do you need a release today?

cstruct commented 3 years ago

No rush, I found this by accident while debugging a segfault at the intersection of aioodbc and aiostream.