1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-12-01 16:28:12 +09:00

Reduce memory usage in file migration tool

This commit is contained in:
syuilo 2018-10-11 15:56:18 +09:00
parent 1117ce4b54
commit bf98a11b65
No known key found for this signature in database
GPG Key ID: BDC4C49D06AB9D69

View File

@ -11,8 +11,16 @@ DriveFile.find({
}, { }, {
withoutChunks: false withoutChunks: false
}] }]
}, {
fields: {
_id: true
}
}).then(async files => { }).then(async files => {
console.log(`there is ${files.length} files`);
await sequential(files.map(file => async () => { await sequential(files.map(file => async () => {
file = await DriveFile.findOne({ _id: file._id });
const minio = new Minio.Client(config.drive.config); const minio = new Minio.Client(config.drive.config);
const keyDir = `${config.drive.prefix}/${uuid.v4()}`; const keyDir = `${config.drive.prefix}/${uuid.v4()}`;