对于发送文件失败,3s后进行重试

This commit is contained in:
zhang_xubo
2021-09-02 11:59:32 +08:00
parent c7365e9e17
commit f02fe82173

View File

@ -750,6 +750,14 @@ class SshTool():
self.__errorPath, srcFile,
targetDir, self.__resultFile)
(status, output) = subprocess.getstatusoutput(scpCmd)
# If sending the file fails, we retry after 3s to avoid the
# failure caused by intermittent network disconnection.
# If the fails is caused by timeout. no need to retry.
if status != 0 and output.find("Timed out") < 0:
time.sleep(3)
(status, output) = subprocess.getstatusoutput(scpCmd)
if status != 0:
raise Exception(ErrorCode.GAUSS_502["GAUSS_50216"]
% ("file [%s]" % srcFile) +