@nger/fk-upload 1.0.79 → 1.0.80

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.
@@ -34,6 +34,7 @@ class DownloadTask extends rabbitmq_1.Task {
34
34
  const download = await db.manager.findOne(entities_1.FkDownloadTaskEntity, { where: { filename: task.filename } });
35
35
  if (download.status !== 0) {
36
36
  complete();
37
+ this.downloadingCount -= 1;
37
38
  return next && next();
38
39
  }
39
40
  (0, fs_extra_1.ensureDir)((0, path_1.dirname)(task.path));
@@ -77,6 +78,7 @@ class DownloadTask extends rabbitmq_1.Task {
77
78
  req.on('response', async (resp) => {
78
79
  const headers = resp.headers;
79
80
  total = Number(headers["content-length"]);
81
+ console.log(`${task.filename} total is ${total}b`);
80
82
  if (total > 1024 * 1024 * 1024) {
81
83
  console.log(`file is to large`);
82
84
  req.destroy();
@@ -24,14 +24,20 @@ class UploadTask extends rabbitmq_1.Task {
24
24
  // not exist
25
25
  if (!old) {
26
26
  complete();
27
+ this.runingCount -= 1;
28
+ return next && next();
27
29
  }
28
30
  // > 1G give up
29
31
  if (task.total >= 1024 * 1024 * 1024) {
30
32
  complete();
33
+ this.runingCount -= 1;
34
+ return next && next();
31
35
  }
32
36
  if (!(0, fs_1.existsSync)(task.path) || (old.fileMd5 && old.fileMd5.length > 0)) {
33
37
  await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 0 });
34
38
  complete();
39
+ this.runingCount -= 1;
40
+ return next && next();
35
41
  }
36
42
  if (old.status === 1) {
37
43
  if (this.runingCount > 5) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nger/fk-upload",
3
- "version": "1.0.79",
3
+ "version": "1.0.80",
4
4
  "description": "",
5
5
  "main": "dist/core.js",
6
6
  "types": "dist/core.d.ts",