@nger/fk-upload 1.0.98 → 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.
@@ -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");
@@ -44,10 +45,18 @@ class UploadTask extends rabbitmq_1.Task {
44
45
  const effectTask = await taskService.createEffectTask(res.filename, res.uploadUrl, task.topicId, task.path);
45
46
  await manager.send(effectTask);
46
47
  await complete();
47
- }).catch(e => {
48
+ }).catch(async (e) => {
48
49
  if (e.message === 'to big') {
49
50
  return complete();
50
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);
51
60
  throw e;
52
61
  });
53
62
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nger/fk-upload",
3
- "version": "1.0.98",
3
+ "version": "1.0.99",
4
4
  "description": "",
5
5
  "main": "dist/core.js",
6
6
  "types": "dist/core.d.ts",