web_translate_it 2.1.4 → 2.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/history.md +4 -0
- data/lib/web_translate_it/command_line.rb +3 -2
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab701d78f58fb19e9558b5629385213f9c00c714
|
4
|
+
data.tar.gz: 0c72991d950ecad7e590541de0492fc010b73f8a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9bb26f6986c7ad7823b6cecf2056a129913ffc6b882c4df8122ade59f5335c5d85df1f4e4059bd58d1ecc1abf185eef90e72aec8e1c2e8c82be2d384a05b9b03
|
7
|
+
data.tar.gz: 0466cefbe3af9abc642772539d88f13cf6626c2fc329fde8cb83ca5ee75fe8b8b72dcae2370914c37807e2e34bc07a83da76a46e6eda367c199b824ec458c713
|
data/history.md
CHANGED
@@ -44,7 +44,8 @@ module WebTranslateIt
|
|
44
44
|
# Now actually pulling files
|
45
45
|
time = Time.now
|
46
46
|
threads = []
|
47
|
-
|
47
|
+
n_threads = (files.size.to_f/3).ceil >= 10 ? 10 : (files.size.to_f/3).ceil
|
48
|
+
ArrayUtil.chunk(files, n_threads).each do |file_array|
|
48
49
|
unless file_array.empty?
|
49
50
|
threads << Thread.new(file_array) do |file_array|
|
50
51
|
WebTranslateIt::Connection.new(configuration.api_key) do |http|
|
@@ -57,7 +58,7 @@ module WebTranslateIt
|
|
57
58
|
end
|
58
59
|
threads.each { |thread| thread.join }
|
59
60
|
time = Time.now - time
|
60
|
-
puts "Pulled #{files.size} files at #{(files.size/time).round} files/sec."
|
61
|
+
puts "Pulled #{files.size} files at #{(files.size/time).round} files/sec, using #{n_threads} threads."
|
61
62
|
`#{configuration.after_pull}` if configuration.after_pull
|
62
63
|
end
|
63
64
|
end
|