@nger/fk-upload 1.0.58 → 1.0.61

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.
@@ -141,30 +141,14 @@ let FkService = class FkService {
141
141
  }).then(res => {
142
142
  return res.data;
143
143
  }).catch(async (e) => {
144
- const info = await this.getUploadInfo(task.loginId, task.filename, task.fileMd5, task.total);
145
- task.cookies = info.cookies;
146
- task.splitSize = info.splitSize;
147
- task.start = info.uploadedSize;
148
- task.uploadUrl = info.uploadUrl;
149
- task.index = Math.ceil(info.uploadedSize / info.splitSize);
150
- console.log(info);
151
- await this.uploadFile(task);
152
- return;
144
+ throw e;
153
145
  });
154
146
  if (!uploadResult) {
155
147
  complete = true;
156
148
  break;
157
149
  }
158
150
  if (uploadResult.code !== 200) {
159
- console.log(uploadResult, { size: end - start });
160
- const info = await this.getUploadInfo(task.loginId, task.filename, task.fileMd5, task.total);
161
- task.cookies = info.cookies;
162
- task.splitSize = info.splitSize;
163
- task.start = info.uploadedSize;
164
- task.uploadUrl = info.uploadUrl;
165
- task.index = Math.ceil(info.uploadedSize / info.splitSize);
166
- await this.uploadFile(task);
167
- return;
151
+ throw new Error(uploadResult.code);
168
152
  }
169
153
  if (uploadResult) {
170
154
  const data = uploadResult.data;
@@ -19,6 +19,10 @@ class UploadTask extends rabbitmq_1.Task {
19
19
  const taskService = injector.get(task_service_1.TaskService);
20
20
  const manager = injector.get(rabbitmq_1.TaskManager);
21
21
  const db = injector.get(typeorm_1.Db);
22
+ // > 1G give up
23
+ if (task.total >= 1024 * 1024 * 1024) {
24
+ complete();
25
+ }
22
26
  await fk.startUploadFile(task).then(async (res) => {
23
27
  // create effect task
24
28
  await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 2, uploadUrl: task.uploadUrl, uploadSize: task.total, uploadStatus: 1 });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nger/fk-upload",
3
- "version": "1.0.58",
3
+ "version": "1.0.61",
4
4
  "description": "",
5
5
  "main": "dist/core.js",
6
6
  "types": "dist/core.d.ts",