mirror of https://github.com/Chocobozzz/PeerTube
Speed up populate database script
parent
68037af892
commit
7279b45581
|
@ -67,8 +67,6 @@ async function rateVideo (req: express.Request, res: express.Response) {
|
||||||
dislikes: dislikesToIncrement
|
dislikes: dislikesToIncrement
|
||||||
}
|
}
|
||||||
|
|
||||||
// Even if we do not own the video we increment the attributes
|
|
||||||
// It is useful for the user to have a feedback
|
|
||||||
await videoInstance.increment(incrementQuery, sequelizeOptions)
|
await videoInstance.increment(incrementQuery, sequelizeOptions)
|
||||||
|
|
||||||
await sendVideoRateChange(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
|
await sendVideoRateChange(accountInstance, videoInstance, likesToIncrement, dislikesToIncrement, t)
|
||||||
|
|
|
@ -38,15 +38,26 @@ async function start () {
|
||||||
|
|
||||||
// Forever
|
// Forever
|
||||||
const fakeTab = Array.from(Array(1000000).keys())
|
const fakeTab = Array.from(Array(1000000).keys())
|
||||||
await Bluebird.map(fakeTab, () => {
|
const funs = [
|
||||||
return Promise.all([
|
uploadCustom
|
||||||
uploadCustom(server),
|
// uploadCustom,
|
||||||
likeCustom(server),
|
// uploadCustom,
|
||||||
dislikeCustom(server),
|
// uploadCustom,
|
||||||
createUserCustom(server),
|
// likeCustom,
|
||||||
createCustomChannel(server)
|
// createUserCustom,
|
||||||
]).catch(err => console.error(err))
|
// createCustomChannel
|
||||||
}, { concurrency: 5 })
|
]
|
||||||
|
const promises = []
|
||||||
|
|
||||||
|
for (const fun of funs) {
|
||||||
|
promises.push(
|
||||||
|
Bluebird.map(fakeTab, () => {
|
||||||
|
return fun(server).catch(err => console.error(err))
|
||||||
|
}, { concurrency: 3 })
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
await Promise.all(promises)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandomInt (min, max) {
|
function getRandomInt (min, max) {
|
||||||
|
|
Loading…
Reference in New Issue