diff options
| author | syuilo <syuilotan@yahoo.co.jp> | 2018-10-11 15:56:18 +0900 |
|---|---|---|
| committer | syuilo <syuilotan@yahoo.co.jp> | 2018-10-11 15:56:18 +0900 |
| commit | bf98a11b6545699dce7a24bdaaa2deb428224685 (patch) | |
| tree | f29fda366515e1fff511bc5c06b7ccdaacc4ad78 /src/tools | |
| parent | Redisをオプションにしたり (diff) | |
| download | sharkey-bf98a11b6545699dce7a24bdaaa2deb428224685.tar.gz sharkey-bf98a11b6545699dce7a24bdaaa2deb428224685.tar.bz2 sharkey-bf98a11b6545699dce7a24bdaaa2deb428224685.zip | |
Reduce memory usage in file migration tool
Diffstat (limited to 'src/tools')
| -rw-r--r-- | src/tools/move-drive-files.ts | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/tools/move-drive-files.ts b/src/tools/move-drive-files.ts index 1e6fdcf606..23d1b9497e 100644 --- a/src/tools/move-drive-files.ts +++ b/src/tools/move-drive-files.ts @@ -11,8 +11,16 @@ DriveFile.find({ }, { withoutChunks: false }] +}, { + fields: { + _id: true + } }).then(async files => { + console.log(`there is ${files.length} files`); + await sequential(files.map(file => async () => { + file = await DriveFile.findOne({ _id: file._id }); + const minio = new Minio.Client(config.drive.config); const keyDir = `${config.drive.prefix}/${uuid.v4()}`; |