aws-sdk-s3 1.117.1 → 1.118.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -67,9 +67,13 @@ module Aws
67
67
 
68
68
  def upload_parts(upload_id, options, &block)
69
69
  completed = Queue.new
70
+ thread_errors = []
70
71
  errors = begin
71
72
  IO.pipe do |read_pipe, write_pipe|
72
- threads = upload_in_threads(read_pipe, completed, upload_part_opts(options).merge(upload_id: upload_id))
73
+ threads = upload_in_threads(
74
+ read_pipe, completed,
75
+ upload_part_opts(options).merge(upload_id: upload_id),
76
+ thread_errors)
73
77
  begin
74
78
  block.call(write_pipe)
75
79
  ensure
@@ -79,7 +83,7 @@ module Aws
79
83
  threads.map(&:value).compact
80
84
  end
81
85
  rescue => e
82
- [e]
86
+ thread_errors + [e]
83
87
  end
84
88
 
85
89
  if errors.empty?
@@ -142,7 +146,7 @@ module Aws
142
146
  end
143
147
  end
144
148
 
145
- def upload_in_threads(read_pipe, completed, options)
149
+ def upload_in_threads(read_pipe, completed, options, thread_errors)
146
150
  mutex = Mutex.new
147
151
  part_number = 0
148
152
  @thread_count.times.map do
@@ -179,7 +183,10 @@ module Aws
179
183
  nil
180
184
  rescue => error
181
185
  # keep other threads from uploading other parts
182
- mutex.synchronize { read_pipe.close_read unless read_pipe.closed? }
186
+ mutex.synchronize do
187
+ thread_errors.push(error)
188
+ read_pipe.close_read unless read_pipe.closed?
189
+ end
183
190
  error
184
191
  end
185
192
  end