Skip to content

[+]优化:1.Generator改用queue 2.兼容Py2 #1

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

Merged
merged 1 commit into from
Jan 11, 2019

Conversation

jerrychan807
Copy link
Contributor

1. Generator改用queue

一开始我是用py2跑的,我测试的是https://theora.org/.svn,下载svn版本大于1.7的时候有问题。
并不能成功下载完所有文件,只是下了一个wc.db数据库文件

看了一下线程的运行图,很快就结束了

查了下资料,参考链接: multithreading: Why aren't generators thread-safe? What happens when it is shared among threads?

可能是因为Generator是线程不安全的导致的,然后我就改成thread-safequeue来存放待下载的文件。

您不妨可以测测该站点,或者google hack一下:Index of /.svn找到别的svn版本大于1.7的站点

2.兼容py2

因为我用py2多呀.hhhh

Generator是线程不安全的,下载多文件的时候容易卡死
@admintony admintony merged commit 9b6b2b3 into admintony:master Jan 11, 2019
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

Successfully merging this pull request may close these issues.

2 participants