node-automator 1.3.7 → 1.3.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/commands/ali_oss.js +7 -9
- package/package.json +1 -1
package/commands/ali_oss.js
CHANGED
|
@@ -76,8 +76,8 @@ class AliOssCommand extends BaseCommand {
|
|
|
76
76
|
}
|
|
77
77
|
case "UPLOAD_FILES": {
|
|
78
78
|
let dst_folder = this.selfData.dst;
|
|
79
|
-
let concurrency = this.selfData.options && this.selfData.options.concurrency ||
|
|
80
|
-
let timeout = this.selfData.options && this.selfData.options.timeout || 1000 * 60 *
|
|
79
|
+
let concurrency = this.selfData.options && this.selfData.options.concurrency || 5;
|
|
80
|
+
let timeout = this.selfData.options && this.selfData.options.timeout || 1000 * 60 * 5;
|
|
81
81
|
let strategy = this.selfData.options && this.selfData.options.strategy || "hash";
|
|
82
82
|
let base = this.selfData.base;
|
|
83
83
|
whisper(`在 ${base} 中收集要上传的文件...`, undefined, true);
|
|
@@ -156,14 +156,8 @@ class AliOssCommand extends BaseCommand {
|
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
queueAsync(tasks, concurrency, (done, total, index, indexDone) => {
|
|
159
|
-
const src = srcs[index];
|
|
160
|
-
if (done) {
|
|
161
|
-
// 当前上传的,存储为 hash
|
|
162
|
-
let dst = path.join(dst_folder, path.relative(base, src)).replace(/\\/g, "/")
|
|
163
|
-
cachedFiles[dst] = crypto.createHash("md5").update(readFileSync(src)).digest("hex");
|
|
164
|
-
}
|
|
165
159
|
progress(done, total, {
|
|
166
|
-
desc: path.relative(base,
|
|
160
|
+
desc: path.relative(base, srcs[index]) + " " + (indexDone ? "上传成功!" : "上传中..."),
|
|
167
161
|
depth: 0,
|
|
168
162
|
});
|
|
169
163
|
}).then((result) => {
|
|
@@ -172,6 +166,10 @@ class AliOssCommand extends BaseCommand {
|
|
|
172
166
|
if (result[i].err) {
|
|
173
167
|
retrySrcs.push(srcs[i]);
|
|
174
168
|
warn(`上传文件 ${path.relative(base, srcs[i])} 失败: ${result[i].err}`);
|
|
169
|
+
} else {
|
|
170
|
+
// 当前上传的,存储为 hash
|
|
171
|
+
let dst = path.join(dst_folder, path.relative(base, srcs[i])).replace(/\\/g, "/")
|
|
172
|
+
cachedFiles[dst] = crypto.createHash("md5").update(readFileSync(srcs[i])).digest("hex");
|
|
175
173
|
}
|
|
176
174
|
}
|
|
177
175
|
if (retrySrcs.length > 0) {
|