Skip to content

Commit

Permalink
update upyun
Browse files Browse the repository at this point in the history
  • Loading branch information
kitmanzheng committed Jan 16, 2020
1 parent 1d667e6 commit 7d28a29
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Binary file modified dep/cos_migrate_tool-1.0-jar-with-dependencies.jar
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ public void doTask() {

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

contentMd5 = headers.get("Content-MD5");
contentMd5 = headers.get("Content-Md5");
}

download_success = this.upyun
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,32 @@ public void buildTask() {

int retry_num = 0;
LinkedList<String> dirList = new LinkedList<String>();
LinkedList<String> itrList = new LinkedList<String>();
dirList.add("");
itrList.add("");

do {
String curDir = "";
String lastItr = "";
try {
while (!dirList.isEmpty()) {
String curDir = dirList.removeFirst();
String lastItr = "";

curDir = dirList.removeFirst();
if (itrList.size()>0) {
lastItr = itrList.removeFirst();
} else {
lastItr = "";
}
FolderItemIter folderItemIter;
do {
Map<String, String> params = new HashMap<String, String>();

/*
if (System.currentTimeMillis() % 3 == 0) {
throw new Exception("test timeout");
}
*/
params.put("x-list-iter", lastItr);
params.put("x-list-limit", "1000");
params.put("x-list-limit", "1000");

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

} catch (Exception e) {
log.error("retry_time:{}, Exception:{}", retry_num,e.getMessage());
dirList.addFirst(curDir);
itrList.addFirst(lastItr);
log.error("curDir:{},lastItr:{},retry_time:{}, Exception:{}", curDir, lastItr,retry_num,e.getMessage());
TaskStatics.instance.setListFinished(false);
}

Expand Down

0 comments on commit 7d28a29

Please sign in to comment.