ddstats-server/tests/multihread.test.js

24 lines
512 B
JavaScript
Raw Normal View History

import { initWorkers, spread } from '../libs/utils/multithread.js'
2021-10-13 20:27:07 +02:00
import Finish from '../schemas/Finish-copy.js'
import initLog from '../libs/utils/log.js'
2021-10-13 20:27:07 +02:00
const log = initLog("sqlite2mongo")
2021-10-13 19:45:59 +02:00
2021-10-13 20:27:07 +02:00
initWorkers(6)
export default async function() {
log("Checking for new finishes...")
await Finish.deleteMany({})
let offset = -1
while (offset < 10000000) {
2021-10-13 23:10:51 +02:00
await spread(
'./db.test.js',
{
offset
2021-10-13 19:45:59 +02:00
}
2021-10-13 20:27:07 +02:00
)
offset += 5000
}
2021-10-13 19:45:59 +02:00
}