From b8b109d32dc673524245c3580efdff65f1920fb3 Mon Sep 17 00:00:00 2001 From: texuf Date: Tue, 6 Aug 2024 14:23:59 -0700 Subject: [PATCH 1/2] Stop the stress clients when the stress test is over --- 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..c13d44928 100644 --- a/packages/stress/src/mode/chat/root_chat.ts +++ b/packages/stress/src/mode/chat/root_chat.ts @@ -158,6 +158,12 @@ export async function startStressChat(opts: { } }) + for (let i = 0; i < clients.length; i += 1) { + const client = clients[i] + logger.log(`stopping ${client.logId}`) + await client.stop() + } + logger.log('sumarizeChat') const summary = await sumarizeChat(clients, chatConfig, errors) 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)}` From 04f5ab46948169a1c7c31dadfd58d7d8872d59d1 Mon Sep 17 00:00:00 2001 From: texuf Date: Tue, 6 Aug 2024 14:48:20 -0700 Subject: [PATCH 2/2] fix order of operations --- packages/stress/src/mode/chat/root_chat.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/stress/src/mode/chat/root_chat.ts b/packages/stress/src/mode/chat/root_chat.ts index c13d44928..a90a377a0 100644 --- a/packages/stress/src/mode/chat/root_chat.ts +++ b/packages/stress/src/mode/chat/root_chat.ts @@ -158,17 +158,17 @@ export async function startStressChat(opts: { } }) + logger.log('sumarizeChat') + const summary = await sumarizeChat(clients, chatConfig, errors) + + 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() } - logger.log('sumarizeChat') - const summary = await sumarizeChat(clients, chatConfig, errors) - - logger.log('done', { summary }) - return { summary, chatConfig, opts } }