Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第七章:简单分布式爬虫 #49

Closed
echohuub opened this issue Nov 13, 2017 · 1 comment
Closed

第七章:简单分布式爬虫 #49

echohuub opened this issue Nov 13, 2017 · 1 comment

Comments

@echohuub
Copy link

有个关键点没讲到:multiprocessing.Queue普通的Queue的区别。

如果这里导入了普通的Queue,根本就无法跨进程通信。

而书中你所说的参考1.4.4节中服务进程的代码,1.4.4节中用的普通的Queue,但是后面操作的时候并不是直接用外面创建的普通Queue。

这里容易误导。

@qiyeboy
Copy link
Owner

qiyeboy commented Nov 14, 2017

Queue.Queue是进程内非阻塞队列,multiprocess.Queue是跨进程通信队列。多进程前者是各自私有,后者是各子进程共有。
参考1.4.4节中服务进程的代码,我的本意是参考注册网络的方式,不过你说的问题的确存在,确实是我语焉不详,下次印刷我会添加一个注意,非常感谢。

@qiyeboy qiyeboy closed this as completed Nov 14, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants