Feature or enhancement
Proposal:
Currently consuming items from a queue is very complex. You need to
- use an infinite while loop
- call
queue.task_done() after processing each item
- add all worker tasks to a list
- join the queue
- cancel all worker tasks.
- wait until all worker tasks are cancelled
By adding asyncio.Queue.iter() and asyncio.Queue.iter_nowait(), this becomes a lot easier, you only need to call queue.shutdown(). The same applies to synchronous queues.
Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
Linked PRs
Feature or enhancement
Proposal:
Currently consuming items from a queue is very complex. You need to
queue.task_done()after processing each itemBy adding
asyncio.Queue.iter()andasyncio.Queue.iter_nowait(), this becomes a lot easier, you only need to callqueue.shutdown(). The same applies to synchronous queues.Has this already been discussed elsewhere?
No response given
Links to previous discussion of this feature:
queue.Queuean iterable #120503Linked PRs
*.Queue.iter()and*.Queue.iter_nowait()#120925asyncio.Queue.iter()andasyncio.Queue.iter_nowait()#120927