mirror of
https://github.com/misskey-dev/misskey
synced 2024-11-29 15:28:31 +09:00
fix
This commit is contained in:
parent
bf7601fa8d
commit
36a95c003a
@ -48,16 +48,24 @@ const migrateToGridFS = async (doc) => {
|
|||||||
async function main() {
|
async function main() {
|
||||||
const count = await DriveFile.count({});
|
const count = await DriveFile.count({});
|
||||||
|
|
||||||
|
console.log(`there are ${count} files.`)
|
||||||
|
|
||||||
const dop = Number.parseInt(process.argv[2]) || 5
|
const dop = Number.parseInt(process.argv[2]) || 5
|
||||||
|
const idop = ((count - (count % dop)) / dop) + 1
|
||||||
|
|
||||||
return zip(
|
return zip(
|
||||||
1,
|
1,
|
||||||
async (time) => {
|
async (time) => {
|
||||||
const doc = await DriveFile.find({}, { limit: dop, skip: time * dop })
|
console.log(`${time} / ${idop}`)
|
||||||
|
const doc = await db.get('drive_files').find({}, { limit: dop, skip: time * dop })
|
||||||
return Promise.all(doc.map(migrateToGridFS))
|
return Promise.all(doc.map(migrateToGridFS))
|
||||||
},
|
},
|
||||||
((count - (count % dop)) / dop) + 1
|
idop
|
||||||
)
|
).then(a => {
|
||||||
|
const rv = []
|
||||||
|
a.forEach(e => rv.push(...e))
|
||||||
|
return rv
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
main().then(console.dir).catch(console.error)
|
main().then(console.dir).catch(console.error)
|
||||||
|
Loading…
Reference in New Issue
Block a user