From 4d66ed9623986286413ed19867df6ba68502f100 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=90=95=E5=BD=AA?= <1396799517@qq.com> Date: Thu, 9 May 2019 23:42:25 +0800 Subject: [PATCH] #895 Fix starting multiple fetchers causing fetcher.xmlrpc port conflicts. --- pyspider/run.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pyspider/run.py b/pyspider/run.py index a3753c671..3173f63e5 100755 --- a/pyspider/run.py +++ b/pyspider/run.py @@ -543,8 +543,10 @@ def all(ctx, fetcher_num, processor_num, result_worker_num, run_in): # fetcher fetcher_config = g.config.get('fetcher', {}) fetcher_config.setdefault('xmlrpc_host', '127.0.0.1') - for i in range(fetcher_num): - threads.append(run_in(ctx.invoke, fetcher, **fetcher_config)) + threads.append(run_in(ctx.invoke, fetcher, **fetcher_config)) + for i in range(1, fetcher_num): + fetcher_obj = ctx.invoke(fetcher, get_object=True, **fetcher_config) + threads.append(run_in(fetcher_obj.run)) # scheduler scheduler_config = g.config.get('scheduler', {})