aioamqp icon indicating copy to clipboard operation
aioamqp copied to clipboard

Add cancellation exception handler

Open progovoy opened this issue 8 years ago • 5 comments

This commit handles a proper close of the connection with MQ broker on an outside cancellation of the future. For instance when calling cancel on all of the loop's gathered futures on program termination, the library would just raise an exception.

progovoy avatar Dec 04 '16 20:12 progovoy

Hello there, I was experiencing some kind of similar issues, as for me if library catches asycnio.CancelledError it needs to do internal cleanup and raise again asycnio.CancelledError, otherwise it will incorrect behavio for all nested coroutines. Right now I am using asyncio.shield for any aioamqp channel methods, cuz cancellation of them breaks all actually

hellysmile avatar Dec 08 '16 22:12 hellysmile

So you say we should re-raise the cancel exception after cleanup?

progovoy avatar Dec 08 '16 22:12 progovoy

@progovoy it is up to @Polyconseil, and I am guessing to catch in same way with re-raise asyncio.Timeout

hellysmile avatar Dec 08 '16 22:12 hellysmile

ok so @Polyconseil, please let us know how to proceed. I can add the re-raise or you do. Thank you Victor!

progovoy avatar Dec 08 '16 22:12 progovoy

@hellysmile How should we proceed?

progovoy avatar Jan 24 '17 13:01 progovoy