@nger/fk-upload 1.0.113 → 1.0.116
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.
@@ -2,6 +2,7 @@
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.CheckUploadController = void 0;
|
4
4
|
const tslib_1 = require("tslib");
|
5
|
+
const fk_service_1 = require("./tasks/fk.service");
|
5
6
|
const fs_1 = require("fs");
|
6
7
|
const fk_download_task_entity_1 = require("./../entities/fk-download-task.entity");
|
7
8
|
const rabbitmq_1 = require("@nger/rabbitmq");
|
@@ -84,10 +85,16 @@ let CheckUploadController = class CheckUploadController {
|
|
84
85
|
async checkWaitUploadTask() {
|
85
86
|
const download = this.db.manager.getRepository(fk_download_task_entity_1.FkDownloadTaskEntity);
|
86
87
|
const errors = await download.find({ where: { uploadUrl: (0, typeorm_2.Like)('https://site%') } });
|
87
|
-
|
88
|
+
if (errors && errors.length > 0) {
|
89
|
+
await download.update(errors.map(err => err.filename), { status: 1 });
|
90
|
+
}
|
88
91
|
const list = await download.find({ where: { status: 1, totalSize: (0, typeorm_2.LessThan)(1024 * 1024 * 1024) } });
|
89
92
|
const task = this.injector.get(task_service_1.TaskService);
|
93
|
+
const fk = this.injector.get(fk_service_1.FkService);
|
90
94
|
await Promise.all(list.map(async (item) => {
|
95
|
+
const cloudSize = await fk.getSize(item.url);
|
96
|
+
const localSize = fk.getLocalSize(item.path);
|
97
|
+
console.log({ cloudSize, localSize });
|
91
98
|
const upload = await task.createUploadTask({
|
92
99
|
filename: item.filename,
|
93
100
|
path: item.path,
|
@@ -75,6 +75,11 @@ class ScheduleTask extends rabbitmq_1.Task {
|
|
75
75
|
}
|
76
76
|
}
|
77
77
|
});
|
78
|
+
// check status = 1
|
79
|
+
const waitUploadTask = await db.manager.find(entities_1.FkDownloadTaskEntity, { where: { status: 1 } });
|
80
|
+
// waitUploadTask.map(task => {
|
81
|
+
// taskService.createUploadTask()
|
82
|
+
// })
|
78
83
|
};
|
79
84
|
await run();
|
80
85
|
schedule.scheduleJob(task.name, task.rule, async (time) => {
|
@@ -41,7 +41,9 @@ class UploadTask extends rabbitmq_1.Task {
|
|
41
41
|
await complete();
|
42
42
|
return next && next();
|
43
43
|
}
|
44
|
-
|
44
|
+
const cloudSize = await fk.getSize(old.url);
|
45
|
+
const localSize = fk.getLocalSize(old.path);
|
46
|
+
if (cloudSize != localSize) {
|
45
47
|
await db.manager.update(entities_1.FkDownloadTaskEntity, task.filename, { status: 0 });
|
46
48
|
const download = await taskService.createDownLoadTask(old.url, old.loginId, old.topicId);
|
47
49
|
await manager.send(download);
|