Skip to content

Commit f205012

Browse files
committed
Merge pull request #121 from longbai/retry-host
忽略4xx的重试
2 parents b812e99 + 9cc383b commit f205012

File tree

3 files changed

+2
-13
lines changed

3 files changed

+2
-13
lines changed

qiniu/io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ def put(uptoken, key, data, extra=None):
5353
{'filename': fname, 'data': data, 'mime_type': extra.mime_type},
5454
]
5555
ret, err, code = rpc.Client(conf.UP_HOST).call_with_multipart("/", fields, files)
56-
if err is None or code == 571 or code == 614 or code == 301:
56+
if err is None or code / 100 == 4 or code == 579 or code / 100 == 6 or code / 100 == 7:
5757
return ret, err
5858

5959
ret, err, code = rpc.Client(conf.UP_HOST2).call_with_multipart("/", fields, files)

qiniu/resumable_io.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ def put(uptoken, key, f, fsize, extra):
7979
host = conf.UP_HOST
8080
try:
8181
ret, err, code = put_with_host(uptoken, key, f, fsize, extra, host)
82-
if err is None or code == 571 or code == 614 or code == 301:
82+
if err is None or code / 100 == 4 or code == 579 or code / 100 == 6 or code / 100 == 7:
8383
return ret, err
8484
except:
8585
pass

qiniu/test/io_test.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -177,17 +177,6 @@ def test_put_fail_reqid(self):
177177
ret, err = io.put("", key, data, extra)
178178
assert "reqid" in err
179179

180-
def test_put_with_uphost2(self):
181-
conf.UP_HOST = "api.qiniu.com" # mistake up host
182-
localfile = "%s" % __file__
183-
key = "test_up2_%s" % r(9)
184-
185-
extra.check_crc = 1
186-
ret, err = io.put_file(policy.token(), key, localfile, extra)
187-
assert err is None
188-
assert ret['key'] == key
189-
conf.UP_HOST = "up.qiniu.com"
190-
191180

192181
class Test_get_file_crc32(unittest.TestCase):
193182

0 commit comments

Comments
 (0)