aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/simulate-many-viewers.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2022-06-17 14:34:37 +0200
committerChocobozzz <me@florianbigard.com>2022-06-17 14:56:16 +0200
commitaa2ce188d102ab38452df316d06286040b5d9075 (patch)
tree100e639f21e9798d811639aa2e20abfa4c8d2bbf /scripts/simulate-many-viewers.ts
parentfba911e2c89708a166636e3a93fcd8fcbc3de7e1 (diff)
downloadPeerTube-aa2ce188d102ab38452df316d06286040b5d9075.tar.gz
PeerTube-aa2ce188d102ab38452df316d06286040b5d9075.tar.zst
PeerTube-aa2ce188d102ab38452df316d06286040b5d9075.zip
Optimize view endpoint
Diffstat (limited to 'scripts/simulate-many-viewers.ts')
-rw-r--r--scripts/simulate-many-viewers.ts10
1 files changed, 6 insertions, 4 deletions
diff --git a/scripts/simulate-many-viewers.ts b/scripts/simulate-many-viewers.ts
index fb666c318..a993e175a 100644
--- a/scripts/simulate-many-viewers.ts
+++ b/scripts/simulate-many-viewers.ts
@@ -46,10 +46,12 @@ async function prepare () {
46 } 46 }
47 } 47 }
48 48
49 const env = { PRODUCTION_CONSTANTS: 'true' }
50
49 servers = await Promise.all([ 51 servers = await Promise.all([
50 createSingleServer(1, config, { nodeArgs: [ '--inspect' ] }), 52 createSingleServer(1, config, { env, nodeArgs: [ '--inspect' ] }),
51 createSingleServer(2, config), 53 createSingleServer(2, config, { env }),
52 createSingleServer(3, config) 54 createSingleServer(3, config, { env })
53 ]) 55 ])
54 56
55 await setAccessTokensToServers(servers) 57 await setAccessTokensToServers(servers)
@@ -81,7 +83,7 @@ async function runViewers () {
81 83
82 await Bluebird.map(viewers, viewer => { 84 await Bluebird.map(viewers, viewer => {
83 return servers[0].views.simulateView({ id: videoId, xForwardedFor: viewer.xForwardedFor }) 85 return servers[0].views.simulateView({ id: videoId, xForwardedFor: viewer.xForwardedFor })
84 }, { concurrency: 100 }) 86 }, { concurrency: 500 })
85 87
86 console.log('Finished to run views in %d seconds.', (new Date().getTime() - before) / 1000) 88 console.log('Finished to run views in %d seconds.', (new Date().getTime() - before) / 1000)
87 89