@nger/fk-upload 1.0.96 → 1.0.99
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.
@@ -148,6 +148,13 @@ let FkService = class FkService {
|
|
148
148
|
break;
|
149
149
|
}
|
150
150
|
if (uploadResult.code !== 200) {
|
151
|
+
if (uploadResult.data) {
|
152
|
+
const data = uploadResult.data;
|
153
|
+
if (data.limit) {
|
154
|
+
// to big
|
155
|
+
throw new Error(`to big`);
|
156
|
+
}
|
157
|
+
}
|
151
158
|
throw new Error(`${task.filename}--${uploadResult.msg}`);
|
152
159
|
}
|
153
160
|
if (uploadResult) {
|
@@ -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,7 +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
|
+
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;
|
46
61
|
});
|
47
62
|
}
|
48
63
|
else {
|