Skip to content

Commit 554d458

Browse files
author
libertyzhu
committed
重试逻辑补充
1 parent d20db52 commit 554d458

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
@@ -390,7 +390,7 @@ def send_request(self, method, url, bucket, timeout=30, cos_request=True, ci_req
390390
break
391391
else:
392392
if j < self._retry and client_can_retry(file_position, **kwargs):
393-
if not domain_switched and self._conf._auto_switch_domain_on_retry and self._conf._ip is None:
393+
if not 'x-cos-request-id' in res.headers and not domain_switched and self._conf._auto_switch_domain_on_retry and self._conf._ip is None:
394394
url = switch_hostname_for_url(url)
395395
domain_switched = True
396396
continue
@@ -400,7 +400,7 @@ def send_request(self, method, url, bucket, timeout=30, cos_request=True, ci_req
400400
logger.exception('url:%s, retry_time:%d exception:%s' % (url, j, str(e)))
401401
if j < self._retry and (isinstance(e, ConnectionError) or isinstance(e, Timeout)): # 只重试网络错误
402402
if client_can_retry(file_position, **kwargs):
403-
if not domain_switched and self._conf._auto_switch_domain_on_retry and self._conf._ip is None:
403+
if not 'x-cos-request-id' in res.headers and not domain_switched and self._conf._auto_switch_domain_on_retry and self._conf._ip is None:
404404
url = switch_hostname_for_url(url)
405405
domain_switched = True
406406
continue

0 commit comments

Comments
 (0)