Skip to content

Commit 7d28a29

Browse files
author
kitmanzheng
committed
update upyun
1 parent 1d667e6 commit 7d28a29

File tree

3 files changed

+21
-7
lines changed

3 files changed

+21
-7
lines changed
4.32 KB
Binary file not shown.

src/main/java/com/qcloud/cos_migrate_tool/task/MigrateUpyunTask.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void doTask() {
139139

140140
if (((CopyFromUpyunConfig) config).isCompareMd5()) {
141141
Map<String, String> headers = this.upyun.getFileInfo(UrlEncoderUtils.encodeEscapeDelimiter(this.srcKey));
142-
if (headers == null || !headers.containsKey("Content-MD5")) {
142+
if (headers == null || !headers.containsKey("Content-Md5")) {
143143
String errMsg = String
144144
.format("[fail] taskInfo: %s, can't get fileinfo or content-md5", upyunRecordElement.buildKey());
145145
System.err.println(errMsg);
@@ -148,7 +148,7 @@ public void doTask() {
148148
return;
149149
}
150150

151-
contentMd5 = headers.get("Content-MD5");
151+
contentMd5 = headers.get("Content-Md5");
152152
}
153153

154154
download_success = this.upyun

src/main/java/com/qcloud/cos_migrate_tool/task/MigrateUpyunTaskExecutor.java

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,32 @@ public void buildTask() {
8282

8383
int retry_num = 0;
8484
LinkedList<String> dirList = new LinkedList<String>();
85+
LinkedList<String> itrList = new LinkedList<String>();
8586
dirList.add("");
87+
itrList.add("");
8688

8789
do {
90+
String curDir = "";
91+
String lastItr = "";
8892
try {
8993
while (!dirList.isEmpty()) {
90-
String curDir = dirList.removeFirst();
91-
String lastItr = "";
92-
94+
curDir = dirList.removeFirst();
95+
if (itrList.size()>0) {
96+
lastItr = itrList.removeFirst();
97+
} else {
98+
lastItr = "";
99+
}
93100
FolderItemIter folderItemIter;
94101
do {
95102
Map<String, String> params = new HashMap<String, String>();
96103

104+
/*
105+
if (System.currentTimeMillis() % 3 == 0) {
106+
throw new Exception("test timeout");
107+
}
108+
*/
97109
params.put("x-list-iter", lastItr);
98-
params.put("x-list-limit", "1000");
110+
params.put("x-list-limit", "1000");
99111

100112
folderItemIter = upyun.readDirIter(curDir, params);
101113
lastItr = folderItemIter.iter;
@@ -121,7 +133,9 @@ public void buildTask() {
121133
return;
122134

123135
} catch (Exception e) {
124-
log.error("retry_time:{}, Exception:{}", retry_num,e.getMessage());
136+
dirList.addFirst(curDir);
137+
itrList.addFirst(lastItr);
138+
log.error("curDir:{},lastItr:{},retry_time:{}, Exception:{}", curDir, lastItr,retry_num,e.getMessage());
125139
TaskStatics.instance.setListFinished(false);
126140
}
127141

0 commit comments

Comments
 (0)