Skip to content

Commit

Permalink
Fix some bug in thread upload
Browse files Browse the repository at this point in the history
  • Loading branch information
dt3310321 committed Jan 11, 2018
1 parent 033e196 commit 1f99e53
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions qcloud_cos/cos_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -1279,6 +1279,9 @@ def upload_file(self, Bucket, Key, LocalFilePath, PartSize=10, MAXThread=5, **kw
offset += part_size

pool.wait_completion()
result = pool.get_result()
if not result['success_all']:
raise CosClientError('some upload_part fail after max_retry')
lst = sorted(lst, key=lambda x: x['PartNumber']) # 按PartNumber升序排列

# 完成分片上传
Expand Down Expand Up @@ -1385,6 +1388,10 @@ def copy(self, Bucket, Key, CopySource, CopyStatus='Copy', PartSize=10, MAXThrea
offset += part_size

pool.wait_completion()
result = pool.get_result()
if not result['success_all']:
raise CosClientError('some upload_part_copy fail after max_retry')

lst = sorted(lst, key=lambda x: x['PartNumber']) # 按PartNumber升序排列
# 完成分片上传
try:
Expand Down Expand Up @@ -1450,6 +1457,9 @@ def upload_file_from_buffer(self, Bucket, Key, Body, MaxBufferSize=100, PartSize
data = Body.read(part_size)

pool.wait_completion()
result = pool.get_result()
if not result['success_all']:
raise CosClientError('some upload_part fail after max_retry')
lst = sorted(lst, key=lambda x: x['PartNumber']) # 按PartNumber升序排列

# 完成分片上传
Expand Down

0 comments on commit 1f99e53

Please sign in to comment.