fix(simulator): init statistic counters without possibly overriding the
authorJérôme Benoit <jerome.benoit@sap.com>
Thu, 16 Feb 2023 09:25:27 +0000 (10:25 +0100)
committerJérôme Benoit <jerome.benoit@sap.com>
Thu, 16 Feb 2023 09:25:27 +0000 (10:25 +0100)
initial value

Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
src/performance/PerformanceStatistics.ts

index 909f6345ec0eb7e544c57ca6d96494f7e22103ea..69829ff186e71fd1aca40e465b1c4b654084c8fc 100644 (file)
@@ -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: