@nger/fk-upload 1.0.97 → 1.0.100
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.
@@ -102,7 +102,7 @@ let CheckUploadController = class CheckUploadController {
|
|
102
102
|
};
|
103
103
|
}
|
104
104
|
async checkFinish() {
|
105
|
-
const finishs = await this.db.manager.find(fk_download_task_entity_1.FkDownloadTaskEntity, { where: { status: 3 } });
|
105
|
+
const finishs = await this.db.manager.find(fk_download_task_entity_1.FkDownloadTaskEntity, { where: { status: (0, typeorm_2.In)([1, 2, 3]) } });
|
106
106
|
await Promise.all(finishs.map(finish => {
|
107
107
|
const item = new rabbitmq_1.TaskEntity();
|
108
108
|
item.topic = actions_1.CHECK_ACTION;
|
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.UploadTask = void 0;
|
4
|
+
const redis_1 = require("@nger/redis");
|
4
5
|
const rabbitmq_1 = require("@nger/rabbitmq");
|
5
6
|
const actions_1 = require("./actions");
|
6
7
|
const fk_service_1 = require("./fk.service");
|
@@ -42,12 +43,21 @@ class UploadTask extends rabbitmq_1.Task {
|
|
42
43
|
console.log(`upload success`, res.filename);
|
43
44
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 2, uploadUrl: task.uploadUrl, uploadSize: task.total, uploadStatus: 1 });
|
44
45
|
const effectTask = await taskService.createEffectTask(res.filename, res.uploadUrl, task.topicId, task.path);
|
45
|
-
await manager.send(effectTask)
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
}
|
46
|
+
await manager.send(effectTask);
|
47
|
+
await complete();
|
48
|
+
}).catch(async (e) => {
|
49
|
+
if (e.message === 'to big') {
|
50
|
+
return complete();
|
51
|
+
}
|
52
|
+
//
|
53
|
+
const resdis = injector.get(redis_1.RedisService);
|
54
|
+
let count = await resdis.get(task.filename) || 0;
|
55
|
+
if (count > 5) {
|
56
|
+
return complete();
|
57
|
+
}
|
58
|
+
count += 1;
|
59
|
+
resdis.set(task.filename, count);
|
60
|
+
throw e;
|
51
61
|
});
|
52
62
|
}
|
53
63
|
else {
|