From 71910904d1b0cefc874e39054d72f0c2dd8385bd Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 16 Feb 2023 10:25:27 +0100 Subject: [PATCH] fix(simulator): init statistic counters without possibly overriding the initial value MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- src/performance/PerformanceStatistics.ts | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/performance/PerformanceStatistics.ts b/src/performance/PerformanceStatistics.ts index 909f6345..69829ff1 100644 --- a/src/performance/PerformanceStatistics.ts +++ b/src/performance/PerformanceStatistics.ts @@ -74,10 +74,10 @@ export class PerformanceStatistics { ) { this.statistics.statisticsData.get(command).countRequest++; } else { - this.statistics.statisticsData.set( - command, - Object.assign({ countRequest: 1 }, this.statistics.statisticsData.get(command)) - ); + this.statistics.statisticsData.set(command, { + ...this.statistics.statisticsData.get(command), + countRequest: 1, + }); } break; case MessageType.CALL_RESULT_MESSAGE: @@ -87,10 +87,10 @@ export class PerformanceStatistics { ) { this.statistics.statisticsData.get(command).countResponse++; } else { - this.statistics.statisticsData.set( - command, - Object.assign({ countResponse: 1 }, this.statistics.statisticsData.get(command)) - ); + this.statistics.statisticsData.set(command, { + ...this.statistics.statisticsData.get(command), + countResponse: 1, + }); } break; case MessageType.CALL_ERROR_MESSAGE: @@ -100,10 +100,10 @@ export class PerformanceStatistics { ) { this.statistics.statisticsData.get(command).countError++; } else { - this.statistics.statisticsData.set( - command, - Object.assign({ countError: 1 }, this.statistics.statisticsData.get(command)) - ); + this.statistics.statisticsData.set(command, { + ...this.statistics.statisticsData.get(command), + countError: 1, + }); } break; default: -- 2.34.1