@nger/fk-upload 1.0.73 → 1.0.74
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.
@@ -33,16 +33,18 @@ let CheckUploadController = class CheckUploadController {
|
|
33
33
|
const task = this.db.manager.getRepository(rabbitmq_1.TaskEntity);
|
34
34
|
const list = await task.find({ where: { topic: '@nger/fk-upload/download-task', status: 0 } });
|
35
35
|
await Promise.all(list.map(item => this.manager.send(item)));
|
36
|
-
return { msg: '
|
36
|
+
return { msg: 'redownload success', list };
|
37
37
|
}
|
38
38
|
async checkSpace() {
|
39
39
|
const download = this.db.manager.getRepository(fk_download_task_entity_1.FkDownloadTaskEntity);
|
40
40
|
const list = await download.find({ where: { status: (0, typeorm_2.In)([2, 3]) } });
|
41
|
+
const removes = [];
|
41
42
|
list.map(item => {
|
42
43
|
if ((0, fs_1.existsSync)(item.path)) {
|
43
44
|
(0, fs_extra_1.unlink)(item.path);
|
44
45
|
}
|
45
46
|
});
|
47
|
+
return { msg: 'succes', removes };
|
46
48
|
}
|
47
49
|
};
|
48
50
|
tslib_1.__decorate([
|
@@ -31,6 +31,11 @@ class DownloadTask extends rabbitmq_1.Task {
|
|
31
31
|
const task = injector.get(rabbitmq_1.DATA);
|
32
32
|
const complete = injector.get(rabbitmq_1.COMPLETE);
|
33
33
|
const fail = injector.get(rabbitmq_1.FAIL);
|
34
|
+
const download = await db.manager.findOne(entities_1.FkDownloadTaskEntity, { where: { filename: task.filename } });
|
35
|
+
if (download.status !== 0) {
|
36
|
+
complete();
|
37
|
+
return next && next();
|
38
|
+
}
|
34
39
|
(0, fs_extra_1.ensureDir)((0, path_1.dirname)(task.path));
|
35
40
|
const writeStream = (0, fs_1.createWriteStream)(task.path);
|
36
41
|
const manager = injector.get(rabbitmq_1.TaskManager);
|