diff options
author | Chocobozzz <me@florianbigard.com> | 2022-06-17 14:34:37 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-06-17 14:56:16 +0200 |
commit | aa2ce188d102ab38452df316d06286040b5d9075 (patch) | |
tree | 100e639f21e9798d811639aa2e20abfa4c8d2bbf /scripts/simulate-many-viewers.ts | |
parent | fba911e2c89708a166636e3a93fcd8fcbc3de7e1 (diff) | |
download | PeerTube-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.ts | 10 |
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 | ||