I have the following code:
FTP ... do |ftp| files.each do |file| ... ftp.put(file) sleep 1 end end
I would like to run each file in a separate thread or parallel path. What is the right way to do this? Is it correct?
Here is my parallel pearl attempt
FTP ... do |ftp| Parallel.map(files) do |file| ... ftp.put(file) sleep 1 end end
A parallel transmission / output problem can occur simultaneously:
as = [1,2,3,4,5,6,7,8] results = Parallel.map(as) do |a| puts a end
How can I make puts appear as usual, dividing the line.
source share