Skip to content

Commit d20db52

Browse files
author
libertyzhu
committed
重试逻辑fix
1 parent 3cea130 commit d20db52

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

qcloud_cos/cos_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ def send_request(self, method, url, bucket, timeout=30, cos_request=True, ci_req
375375
res = self._session.head(url, timeout=timeout, proxies=self._conf._proxies, **kwargs)
376376
if res.status_code < 400: # 2xx和3xx都认为是成功的
377377
if res.status_code == 301 or res.status_code == 302 or res.status_code == 307:
378-
if j < self._retry and res.headers['x-cos-request-id'] == '' \
378+
if j < self._retry and not 'x-cos-request-id' in res.headers \
379379
and not domain_switched and self._conf._auto_switch_domain_on_retry and self._conf._ip is None:
380380
url = switch_hostname_for_url(url)
381381
domain_switched = True
382382
continue
383383
return res
384384
elif res.status_code < 500: # 4xx 不重试
385-
if j < self._retry and res.headers['x-cos-request-id'] == '' \
385+
if j < self._retry and not 'x-cos-request-id' in res.headers \
386386
and not domain_switched and self._conf._auto_switch_domain_on_retry and self._conf._ip is None:
387387
url = switch_hostname_for_url(url)
388388
domain_switched = True

0 commit comments

Comments
 (0)