From d594b1e928661bd5d284b75431474eefe61e919a Mon Sep 17 00:00:00 2001 From: Cédric Bonhomme Date: Thu, 12 Feb 2015 08:04:16 +0100 Subject: Minor changes in the crawler (test of asyncio.async). --- pyaggr3g470r/crawler.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'pyaggr3g470r') diff --git a/pyaggr3g470r/crawler.py b/pyaggr3g470r/crawler.py index f7b8ef49..f2ae1599 100644 --- a/pyaggr3g470r/crawler.py +++ b/pyaggr3g470r/crawler.py @@ -192,8 +192,9 @@ def insert_database(user, feed): @asyncio.coroutine def init_process(user, feed): - data = yield from asyncio.async(insert_database(user, feed)) + articles = yield from asyncio.async(insert_database(user, feed)) #print('inserted articles for {}'.format(feed.title)) + return articles def retrieve_feed(user, feed_id=None): """ @@ -212,8 +213,9 @@ def retrieve_feed(user, feed_id=None): # 2 - Fetch the feeds. loop = asyncio.get_event_loop() - f = asyncio.wait([init_process(user, feed) for feed in feeds]) - loop.run_until_complete(f) + tasks = [init_process(user, feed) for feed in feeds] + #tasks = [asyncio.async(init_process(user, feed)) for feed in feeds] + loop.run_until_complete(asyncio.wait(tasks)) """ # 3 - Indexation -- cgit