omnilib / aioitertools

itertools and builtins for AsyncIO and mixed iterables
https://aioitertools.omnilib.dev
MIT License
240 stars 24 forks source link

Don't poll in `as_generated`. #103

Open RedRoserade opened 2 years ago

RedRoserade commented 2 years ago

Description

I noticed that as_generated did polling via asyncio.sleep. I realized that this can be improved by instead making use of one single helper queue that keeps track of what the tailers produce. So, this changeset makes use of a single queue with value wrappers to signal to the queue consumer what to do. It also prevents polling, which could make this more efficient.

Fixes: Nothing