From a8b2af256b38aeb054d4ce670d6e273006586709 Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Wed, 27 May 2015 14:39:27 +0200 Subject: Run the asyncio loop in a try block. --- pyaggr3g470r/crawler.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py index cada119b..8052fb63 100644 --- a/pyaggr3g470r/crawler.py +++ b/pyaggr3g470r/crawler.py @@ -248,7 +248,9 @@ def retrieve_feed(user, feed_id=None): tasks = [asyncio.ensure_future(init_process(user, feed)) for feed in feeds] except: tasks = [init_process(user, feed) for feed in feeds] - loop.run_until_complete(asyncio.wait(tasks)) - loop.close() + try: + loop.run_until_complete(asyncio.wait(tasks)) + finally: + loop.close() logger.info("All articles retrieved. End of the processus.") -- cgit