From 162f0d66891afe0cf701c05c50b1e8fff8c62194 Mon Sep 17 00:00:00 2001 From: texuf Date: Tue, 6 Aug 2024 15:09:43 -0700 Subject: [PATCH] Stop the stress clients when the stress test is over (#652) --- packages/stress/src/mode/chat/root_chat.ts | 6 ++++++ packages/stress/src/utils/stressClient.ts | 4 +++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/stress/src/mode/chat/root_chat.ts b/packages/stress/src/mode/chat/root_chat.ts index 5638bff02..a90a377a0 100644 --- a/packages/stress/src/mode/chat/root_chat.ts +++ b/packages/stress/src/mode/chat/root_chat.ts @@ -163,6 +163,12 @@ export async function startStressChat(opts: { logger.log('done', { summary }) + for (let i = 0; i < clients.length; i += 1) { + const client = clients[i] + logger.log(`stopping ${client.logId}`) + await client.stop() + } + return { summary, chatConfig, opts } } diff --git a/packages/stress/src/utils/stressClient.ts b/packages/stress/src/utils/stressClient.ts index c46592ba8..0ffd38a99 100644 --- a/packages/stress/src/utils/stressClient.ts +++ b/packages/stress/src/utils/stressClient.ts @@ -88,7 +88,9 @@ export class StressClient { public rpcClient: StreamRpcClient, public spaceDapp: SpaceDapp, public streamsClient: StreamsClient, - ) {} + ) { + logger.log('StressClient', { clientIndex, userId, logId: this.logId }) + } get logId(): string { return `client${this.clientIndex}:${shortenHexString(this.userId)}`