|
|
@@ -30,7 +30,7 @@ def parseSource(s):
|
|
|
if not q.empty():
|
|
|
threads=[]
|
|
|
for i in range(num_worker_threads):
|
|
|
- t = threading.Thread(target=news_worker,args=[s["_id"],kw])
|
|
|
+ t = threading.Thread(target=news_worker,args=[s["_id"],s["name"],kw])
|
|
|
t.daemon=True
|
|
|
t.start()
|
|
|
threads.append(t)
|
|
|
@@ -46,7 +46,7 @@ def parseSource(s):
|
|
|
t.join(10)
|
|
|
print("[Source] %s => Finished parsing" %s["name"])
|
|
|
|
|
|
-def news_worker(source_id,kw):
|
|
|
+def news_worker(source_id,source_name,kw):
|
|
|
tname=threading.current_thread().name
|
|
|
while True:
|
|
|
try:
|
|
|
@@ -61,7 +61,7 @@ def news_worker(source_id,kw):
|
|
|
|
|
|
print("[Thread %s] %s" % (tname,item))
|
|
|
try:
|
|
|
- n=News(item,source_id,kw)
|
|
|
+ n=News(item,source_id,source_name,kw)
|
|
|
print("[Thread %s] Finished" % tname)
|
|
|
d.insert_article(n.get())
|
|
|
except:
|