Recently discover that it can call q.join() on a closed queue. And I notice the q.join() will block forever even after the queue being closed.
It is better that it should check parent queue is closing or not, while q.join() calling or to be called.
The q.join() calls should raise RuntimeError, when q.join() calls on a closed queue or when closing a queue while q.join() is calling.
import janus
async def join_after_closing():
q = jauns.Queue()
await q.async_q.put("boo")
q.close()
await q.async_q.join() # blocks forever
async def close_after_join():
q = jauns.Queue()
await q.async_q.put("boo")
task = janus.ensure_future(q.async_q.join())
await asyncio.sleep(1) # ensure the task is blocking
q.close()
await task # blocks forever too