You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Basically the Synchroniser must discard cancelled futures. Example:
importasyncioimportasynqp@asyncio.coroutinedefmain_coro(loop):
# connect to the RabbitMQ brokerconnection=yieldfromasynqp.connect(
'localhost', 5672, username='guest', password='guest')
# Open a communications channelchannel=yieldfromconnection.open_channel()
queue=yieldfromchannel.declare_queue('test.queue')
get_task=asyncio.async(queue.get())
print("It can go up to here")
# We have bad connection so get timed out.try:
yieldfromasyncio.wait_for(get_task, timeout=0.0001)
exceptasyncio.TimeoutError:
pass# Next get will hang cause we did not cleanup future in Synchroniseryieldfromqueue.get()
print("but hangs here =(")
yieldfromchannel.close()
yieldfromconnection.close()
defmain():
loop=asyncio.get_event_loop()
main_task=asyncio.async(main_coro(loop))
try:
loop.run_until_complete(main_task)
exceptKeyboardInterrupt:
main_task.cancel()
loop.run_until_complete(main_task)
if__name__=="__main__":
main()
The text was updated successfully, but these errors were encountered:
It's an easy fix after #49, but needs some descend tests I think. It's easy to encounter this issue when doing reconnect (you will want a wait_for wrapper just in case)
Ok, It seems harder than I thought if would be... Even after I patched the synchroniser it fails, cause the reader.ready() is not called. We can replace the code so reader.ready is called even if we cancel the coroutine, but I find it disturbing to do so...
I thought it would be as easy fix as this commit but if doesn't work =(
Basically the Synchroniser must discard cancelled futures. Example:
The text was updated successfully, but these errors were encountered: