pindo 4.7.8 → 4.7.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pindo/client/pgyeruploadclient.rb +4 -27
- data/lib/pindo/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6aaeca7f069b61265bf65ea62d49bf8b3d3e64ccf2755475a68c37afa54b12fb
|
4
|
+
data.tar.gz: 980495658d7accae82e4bf4f11913892edfb0efeaae49438e9003f9a67aed5f2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f89ffccfccdd56678fe98cac69f9eb621276a264aa93bd7bdd55d78995220cfc25b199c6f1da3b4ebf7a03e7b3a86b75568e8a252da3089c2211f088c0195e33
|
7
|
+
data.tar.gz: 566ff17b4b945007869f8acdce6d5e7bb10ec688973f82ad92aeb7e10dd12e9ddf4fb570424b3892813af57601d821ac867c586a3dbc9b967b7e0d9e5763ba50
|
@@ -94,7 +94,7 @@ module Pindo
|
|
94
94
|
|
95
95
|
upload_path_key = upload_path + file_uuid + extension
|
96
96
|
|
97
|
-
task_num =
|
97
|
+
task_num = 10
|
98
98
|
|
99
99
|
puts "文件路径: #{@upload_binary_file}"
|
100
100
|
puts "文件大小: #{total_m}M"
|
@@ -121,6 +121,7 @@ module Pindo
|
|
121
121
|
multi_task_upload_data_req(task_num:task_num)
|
122
122
|
|
123
123
|
result_data = post_upload_finish_req(upload_path_key:upload_path_key, upload_id:upload_id, eTags:@upload_eTags)
|
124
|
+
puts result_data
|
124
125
|
if result_data["code"] == 200
|
125
126
|
upload_result = upload_path_key
|
126
127
|
Funlog.instance.fancyinfo_success("文件#{@upload_binary_file} 上传成功! 😎😎😎")
|
@@ -136,7 +137,6 @@ module Pindo
|
|
136
137
|
|
137
138
|
def multi_task_upload_data_req(task_num:1)
|
138
139
|
|
139
|
-
# puts "add task_num :#{task_num}"
|
140
140
|
|
141
141
|
for i in 0..@upload_params_list.length-1 do
|
142
142
|
@upload_params_list[i]["retryCount"] = 3
|
@@ -145,10 +145,9 @@ module Pindo
|
|
145
145
|
while @upload_params_list.size > 0
|
146
146
|
upload_params_list_temp = []
|
147
147
|
#每次最大5个线程上传
|
148
|
-
for i in
|
148
|
+
for i in 1..task_num do
|
149
149
|
upload_params_list_temp << @upload_params_list.shift
|
150
150
|
end
|
151
|
-
|
152
151
|
hydra = Typhoeus::Hydra.new
|
153
152
|
while upload_params_list_temp.size > 0
|
154
153
|
upload_params_item = upload_params_list_temp.shift
|
@@ -172,11 +171,6 @@ module Pindo
|
|
172
171
|
single_task_upload_part_data_req(upload_params_item:upload_params_item)
|
173
172
|
end
|
174
173
|
|
175
|
-
# if !@upload_params_list.nil? && @upload_params_list.length > 0
|
176
|
-
# for i in 0..@upload_params_list.length-1 do
|
177
|
-
# eTag_item = single_task_upload_part_data_req(upload_params_item:@upload_params_list[i])
|
178
|
-
# end
|
179
|
-
# end
|
180
174
|
|
181
175
|
return @eTags
|
182
176
|
end
|
@@ -200,13 +194,8 @@ module Pindo
|
|
200
194
|
|
201
195
|
request = create_req(upload_url:upload_url, body_data:put_data, read_length:read_length)
|
202
196
|
|
203
|
-
# @upload_num = start_position
|
204
|
-
|
205
197
|
request.on_progress do |dltotal, dlnow, ultotal, ulnow|
|
206
|
-
# puts "dltotal (#{dltotal}), dlnow (#{dlnow}), ultotal (#{ultotal}), ulnow (#{ulnow})"
|
207
198
|
if ulnow
|
208
|
-
# @upload_num = start_position + ulnow
|
209
|
-
# set_progress(@upload_num, @file_size)
|
210
199
|
@progress_bar.update_upload_index(upload_part:part_no, upload_size:ulnow)
|
211
200
|
@progress_bar.update_upload_progress()
|
212
201
|
end
|
@@ -214,17 +203,6 @@ module Pindo
|
|
214
203
|
|
215
204
|
eTag_item = nil
|
216
205
|
|
217
|
-
request.on_failure do |response|
|
218
|
-
@progress_bar.delete_upload_index(upload_part:part_no)
|
219
|
-
upload_params_item["retryCount"] = upload_params_item["retryCount"] - 1
|
220
|
-
if upload_params_item["retryCount"] > 0
|
221
|
-
@upload_params_list.push(upload_params_item)
|
222
|
-
else
|
223
|
-
Funlog.instance.fancyinfo_error("文件#{@upload_binary_file} 上传失败! 😭😭😭")
|
224
|
-
raise Informative "上传文件失败"
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
206
|
request.on_complete do |response|
|
229
207
|
if response.success?
|
230
208
|
@progress_bar.complete_upload_index(upload_part:part_no, complete_size:read_length)
|
@@ -238,7 +216,7 @@ module Pindo
|
|
238
216
|
@upload_params_list.push(upload_params_item)
|
239
217
|
else
|
240
218
|
Funlog.instance.fancyinfo_error("文件#{@upload_binary_file} 上传失败! 😭😭😭")
|
241
|
-
raise Informative "上传文件失败"
|
219
|
+
raise Informative, "上传文件失败"
|
242
220
|
end
|
243
221
|
end
|
244
222
|
end
|
@@ -256,7 +234,6 @@ module Pindo
|
|
256
234
|
def create_req(upload_url:nil, body_data:nil, read_length:nil)
|
257
235
|
|
258
236
|
request = nil
|
259
|
-
|
260
237
|
proxy_options = {
|
261
238
|
proxy: ENV['http_proxy'] || ENV['https_proxy'],
|
262
239
|
proxyuserpwd: "#{ENV['HTTP_PROXY_USER']}:#{ENV['HTTP_PROXY_PASSWORD']}"
|
data/lib/pindo/version.rb
CHANGED