aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/benchmark.ts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/benchmark.ts')
-rw-r--r--scripts/benchmark.ts30
1 files changed, 10 insertions, 20 deletions
diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts
index fcfc67bf7..321b07c94 100644
--- a/scripts/benchmark.ts
+++ b/scripts/benchmark.ts
@@ -1,19 +1,10 @@
1import { registerTSPaths } from '../server/helpers/register-ts-paths'
2registerTSPaths()
3
4import * as autocannon from 'autocannon' 1import * as autocannon from 'autocannon'
5import {
6 addVideoCommentReply,
7 addVideoCommentThread,
8 flushAndRunServer,
9 getVideosList,
10 killallServers,
11 ServerInfo,
12 setAccessTokensToServers,
13 uploadVideo
14} from '@shared/extra-utils'
15import { Video, VideoPrivacy } from '@shared/models'
16import { writeJson } from 'fs-extra' 2import { writeJson } from 'fs-extra'
3import { flushAndRunServer, getVideosList, killallServers, ServerInfo, setAccessTokensToServers, uploadVideo } from '@shared/extra-utils'
4import { Video, VideoPrivacy } from '@shared/models'
5import { registerTSPaths } from '../server/helpers/register-ts-paths'
6
7registerTSPaths()
17 8
18let server: ServerInfo 9let server: ServerInfo
19let video: Video 10let video: Video
@@ -228,18 +219,17 @@ async function prepare () {
228 219
229 for (let i = 0; i < 10; i++) { 220 for (let i = 0; i < 10; i++) {
230 const text = 'my super first comment' 221 const text = 'my super first comment'
231 const res = await addVideoCommentThread(server.url, server.accessToken, video.id, text) 222 const created = await server.commentsCommand.createThread({ videoId: video.id, text })
232 threadId = res.body.comment.id 223 threadId = created.id
233 224
234 const text1 = 'my super answer to thread 1' 225 const text1 = 'my super answer to thread 1'
235 const childCommentRes = await addVideoCommentReply(server.url, server.accessToken, video.id, threadId, text1) 226 const child = await server.commentsCommand.addReply({ videoId: video.id, toCommentId: threadId, text: text1 })
236 const childCommentId = childCommentRes.body.comment.id
237 227
238 const text2 = 'my super answer to answer of thread 1' 228 const text2 = 'my super answer to answer of thread 1'
239 await addVideoCommentReply(server.url, server.accessToken, video.id, childCommentId, text2) 229 await server.commentsCommand.addReply({ videoId: video.id, toCommentId: child.id, text: text2 })
240 230
241 const text3 = 'my second answer to thread 1' 231 const text3 = 'my second answer to thread 1'
242 await addVideoCommentReply(server.url, server.accessToken, video.id, threadId, text3) 232 await server.commentsCommand.addReply({ videoId: video.id, toCommentId: threadId, text: text3 })
243 } 233 }
244 234
245 for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) { 235 for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) {