@nger/fk-upload 1.0.119 → 1.0.122
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.
@@ -129,11 +129,7 @@ let FkService = class FkService {
|
|
129
129
|
const max = task.total - 1;
|
130
130
|
let index = task.index || 0;
|
131
131
|
do {
|
132
|
-
console.log(`upload ----- `, index);
|
133
132
|
let start = index * task.splitSize;
|
134
|
-
if (start >= max) {
|
135
|
-
break;
|
136
|
-
}
|
137
133
|
let _end = start + task.splitSize - 1;
|
138
134
|
let end = _end > max ? max : _end;
|
139
135
|
if (end >= max) {
|
@@ -168,11 +164,6 @@ let FkService = class FkService {
|
|
168
164
|
}).catch(async (e) => {
|
169
165
|
throw e;
|
170
166
|
});
|
171
|
-
if (!uploadResult) {
|
172
|
-
complete = true;
|
173
|
-
index = 0;
|
174
|
-
break;
|
175
|
-
}
|
176
167
|
if (uploadResult.code !== 200) {
|
177
168
|
if (uploadResult.data) {
|
178
169
|
const data = uploadResult.data;
|
@@ -183,6 +174,7 @@ let FkService = class FkService {
|
|
183
174
|
}
|
184
175
|
throw new Error(`${task.filename}--${uploadResult.msg}`);
|
185
176
|
}
|
177
|
+
console.log(`upload ----- `, { index, max, start, end });
|
186
178
|
if (uploadResult) {
|
187
179
|
const data = uploadResult.data;
|
188
180
|
const downUrl = data.path;
|
@@ -25,6 +25,7 @@ class UploadTask extends rabbitmq_1.Task {
|
|
25
25
|
async handle(injector, next) {
|
26
26
|
const task = injector.get(rabbitmq_1.DATA);
|
27
27
|
const complete = injector.get(rabbitmq_1.COMPLETE);
|
28
|
+
const fail = injector.get(rabbitmq_1.FAIL);
|
28
29
|
const fk = injector.get(fk_service_1.FkService);
|
29
30
|
const taskService = injector.get(task_service_1.TaskService);
|
30
31
|
const manager = injector.get(rabbitmq_1.TaskManager);
|
@@ -66,10 +67,10 @@ class UploadTask extends rabbitmq_1.Task {
|
|
66
67
|
}
|
67
68
|
if (this.errorCount > 10) {
|
68
69
|
this.errorCount = 0;
|
69
|
-
return
|
70
|
+
return fail();
|
70
71
|
}
|
71
72
|
this.errorCount += 1;
|
72
|
-
console.log(`upload error ${this.errorCount}`, e);
|
73
|
+
console.log(`upload error ${this.errorCount}`, e.message);
|
73
74
|
throw e;
|
74
75
|
});
|
75
76
|
}
|