Dynamically increase size of asyncio.Queue?

Viewed 391

Is it possible to dynamically change (increase) max size of asyncio.Queue object when there are already items in the queue?

What side effects are expected if it is done by manipulating internal properties?

1 Answers

No, it is not possible. There is no method of asyncio.Queue to do this.

To get a queue with a different size you need to create a new one and possibly transfer all items, or you could for example create a setup where you can alternate between two queues, allowing you to replace the one that is currently not in use.


If you decide to manipulate the internal state of the queue that is not accessible through its interface, you might get it to work now, but you can not rely on it to not break when there are any Python updates.

Related