@nger/fk-upload 1.0.121 → 1.0.124
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.
@@ -161,15 +161,10 @@ let FkService = class FkService {
|
|
161
161
|
timeout: 8000
|
162
162
|
}).then(res => {
|
163
163
|
return res.data;
|
164
|
-
}).catch(
|
165
|
-
|
164
|
+
}).catch((e) => {
|
165
|
+
console.log(`upload error`, e.message);
|
166
|
+
return this.startUploadFile(task);
|
166
167
|
});
|
167
|
-
console.log(`upload ----- `, { index, max, start, end, uploadResult });
|
168
|
-
if (!uploadResult) {
|
169
|
-
complete = true;
|
170
|
-
index = 0;
|
171
|
-
break;
|
172
|
-
}
|
173
168
|
if (uploadResult.code !== 200) {
|
174
169
|
if (uploadResult.data) {
|
175
170
|
const data = uploadResult.data;
|
@@ -180,6 +175,7 @@ let FkService = class FkService {
|
|
180
175
|
}
|
181
176
|
throw new Error(`${task.filename}--${uploadResult.msg}`);
|
182
177
|
}
|
178
|
+
console.log(`upload ----- `, { index, max, start, end });
|
183
179
|
if (uploadResult) {
|
184
180
|
const data = uploadResult.data;
|
185
181
|
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);
|
@@ -57,7 +58,7 @@ class UploadTask extends rabbitmq_1.Task {
|
|
57
58
|
// create effect task
|
58
59
|
console.log(`upload success`, res.filename);
|
59
60
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 2, uploadUrl: task.uploadUrl, uploadSize: task.total, uploadStatus: 1 });
|
60
|
-
const effectTask = await taskService.createEffectTask(
|
61
|
+
const effectTask = await taskService.createEffectTask(task.filename, task.uploadUrl, task.topicId, task.path);
|
61
62
|
await manager.send(effectTask);
|
62
63
|
await complete();
|
63
64
|
}).catch(async (e) => {
|
@@ -66,10 +67,9 @@ class UploadTask extends rabbitmq_1.Task {
|
|
66
67
|
}
|
67
68
|
if (this.errorCount > 10) {
|
68
69
|
this.errorCount = 0;
|
69
|
-
return complete();
|
70
70
|
}
|
71
71
|
this.errorCount += 1;
|
72
|
-
console.log(`upload error ${this.errorCount}`, e);
|
72
|
+
console.log(`upload error ${this.errorCount}`, e.message);
|
73
73
|
throw e;
|
74
74
|
});
|
75
75
|
}
|