aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/tests
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2018-07-18 14:17:54 +0200
committerChocobozzz <me@florianbigard.com>2018-07-24 14:04:05 +0200
commit7279b455811f4806dcb74a08d17b837bc22533c1 (patch)
treea92c93f330b86fb76b4c7b8bd7f640ddb2c7d16d /server/tests
parent68037af8926a348fe03dc0b3b95a9553d246de20 (diff)
downloadPeerTube-7279b455811f4806dcb74a08d17b837bc22533c1.tar.gz
PeerTube-7279b455811f4806dcb74a08d17b837bc22533c1.tar.zst
PeerTube-7279b455811f4806dcb74a08d17b837bc22533c1.zip
Speed up populate database script
Diffstat (limited to 'server/tests')
-rw-r--r--server/tests/real-world/populate-database.ts29
1 files changed, 20 insertions, 9 deletions
diff --git a/server/tests/real-world/populate-database.ts b/server/tests/real-world/populate-database.ts
index f0f82f7f8..d41ac8d36 100644
--- a/server/tests/real-world/populate-database.ts
+++ b/server/tests/real-world/populate-database.ts
@@ -38,15 +38,26 @@ async function start () {
38 38
39 // Forever 39 // Forever
40 const fakeTab = Array.from(Array(1000000).keys()) 40 const fakeTab = Array.from(Array(1000000).keys())
41 await Bluebird.map(fakeTab, () => { 41 const funs = [
42 return Promise.all([ 42 uploadCustom
43 uploadCustom(server), 43 // uploadCustom,
44 likeCustom(server), 44 // uploadCustom,
45 dislikeCustom(server), 45 // uploadCustom,
46 createUserCustom(server), 46 // likeCustom,
47 createCustomChannel(server) 47 // createUserCustom,
48 ]).catch(err => console.error(err)) 48 // createCustomChannel
49 }, { concurrency: 5 }) 49 ]
50 const promises = []
51
52 for (const fun of funs) {
53 promises.push(
54 Bluebird.map(fakeTab, () => {
55 return fun(server).catch(err => console.error(err))
56 }, { concurrency: 3 })
57 )
58 }
59
60 await Promise.all(promises)
50} 61}
51 62
52function getRandomInt (min, max) { 63function getRandomInt (min, max) {