aboutsummaryrefslogtreecommitdiff
path: root/pyaggr3g470r/crawler.py
diff options
context:
space:
mode:
authorCédric Bonhomme <cedric@cedricbonhomme.org>2015-02-12 08:04:16 +0100
committerCédric Bonhomme <cedric@cedricbonhomme.org>2015-02-12 08:04:16 +0100
commitd594b1e928661bd5d284b75431474eefe61e919a (patch)
tree289123c22f102b7b34d1934b3f48fb6ab735a729 /pyaggr3g470r/crawler.py
parentTime to sleep. (diff)
downloadnewspipe-d594b1e928661bd5d284b75431474eefe61e919a.tar.gz
newspipe-d594b1e928661bd5d284b75431474eefe61e919a.tar.bz2
newspipe-d594b1e928661bd5d284b75431474eefe61e919a.zip
Minor changes in the crawler (test of asyncio.async).
Diffstat (limited to 'pyaggr3g470r/crawler.py')
-rw-r--r--pyaggr3g470r/crawler.py8
1 files changed, 5 insertions, 3 deletions
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
bgstack15