Dec-19-2018, 10:59 PM
Multithreading/multiprocessing. But in order to easily do that, I'd suggest starting with reorganizing your code so it populates and consumes
For example, start by removing all references to the global variable
queue.Queue
s.For example, start by removing all references to the global variable
final_data
. Try introducing queue.Queue
to store the url/local path pairs, as well as whatever readfile()
returns (it isn't currently obvious what an mj
or lists
is). A new function, who's only job is to process urls, can then be used to spawn multiple threads to handle them in parallel.