X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fbenchmark.ts;h=c29b9abcdb6c9e20f4eb841dbd9234032ae419cb;hb=8e7442d0d818ef25240b46dd1115187c7c042a3a;hp=1d980063bdfb69acf812fa736e58d8f80feebce5;hpb=89d241a79c262b9775c233b73cff080043ebb5e6;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/benchmark.ts b/scripts/benchmark.ts index 1d980063b..c29b9abcd 100644 --- a/scripts/benchmark.ts +++ b/scripts/benchmark.ts @@ -1,12 +1,12 @@ -import * as autocannon from 'autocannon' -import { writeJson } from 'fs-extra' -import { flushAndRunServer, killallServers, ServerInfo, setAccessTokensToServers } from '@shared/extra-utils' -import { Video, VideoPrivacy } from '@shared/models' import { registerTSPaths } from '../server/helpers/register-ts-paths' - registerTSPaths() -let server: ServerInfo +import autocannon, { printResult } from 'autocannon' +import { writeJson } from 'fs-extra' +import { createSingleServer, killallServers, PeerTubeServer, setAccessTokensToServers } from '@shared/extra-utils' +import { Video, VideoPrivacy } from '@shared/models' + +let server: PeerTubeServer let video: Video let threadId: number @@ -149,7 +149,7 @@ async function run () { Object.assign(testResult, { title: test.title, path: test.path }) finalResult.push(testResult) - console.log(autocannon.printResult(testResult)) + console.log(printResult(testResult)) } if (outfile) await writeJson(outfile, finalResult) @@ -188,7 +188,7 @@ function runBenchmark (options: { } async function prepare () { - server = await flushAndRunServer(1, { + server = await createSingleServer(1, { rates_limit: { api: { max: 5_000_000 @@ -232,7 +232,7 @@ async function prepare () { } for (const caption of [ 'ar', 'fr', 'en', 'zh' ]) { - await server.captions.createVideoCaption({ + await server.captions.add({ language: caption, videoId: video.id, fixture: 'subtitle-good2.vtt'