From 5b373a2392b4615ba29bb13f3b312eccf7ae8d49 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Tue, 28 Nov 2023 09:57:42 +0100 Subject: [PATCH] perf(simulator): remove worker configuration attribute from Bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- manifest-cf-template.yml | 2 +- package.json | 2 +- pnpm-lock.yaml | 27 ++++++++++++++++++--------- src/charging-station/Bootstrap.ts | 12 +++++------- 4 files changed, 25 insertions(+), 18 deletions(-) diff --git a/manifest-cf-template.yml b/manifest-cf-template.yml index 8804ef1d..74dcbb8c 100644 --- a/manifest-cf-template.yml +++ b/manifest-cf-template.yml @@ -12,4 +12,4 @@ applications: command: node dist/start.js env: # OPTIMIZE_MEMORY: true - NODE_OPTIONS: --enable-source-maps --stack-trace-limit=1024 --max-old-space-size=768 + NODE_OPTIONS: --enable-source-maps --max-old-space-size=768 diff --git a/package.json b/package.json index c41e1480..b01b427b 100644 --- a/package.json +++ b/package.json @@ -151,7 +151,7 @@ "release-it": "^17.0.0", "rimraf": "^5.0.5", "semver": "^7.5.4", - "tsx": "^4.5.0", + "tsx": "^4.6.0", "typescript": "~5.3.2" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 0c1fd742..378518e3 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -181,8 +181,8 @@ devDependencies: specifier: ^7.5.3 version: 7.5.4 tsx: - specifier: ^4.5.0 - version: 4.5.0 + specifier: ^4.6.0 + version: 4.6.0 typescript: specifier: ~5.3.2 version: 5.3.2 @@ -377,7 +377,7 @@ packages: d3-array: 2.12.1 d3-fg: 6.14.0 d3-selection: 1.4.2 - fs-extra: 11.1.1 + fs-extra: 11.2.0 lodash.debounce: 4.0.8 on-net-listen: 1.1.2 pump: 3.0.0 @@ -530,7 +530,7 @@ packages: dependencies: '@commitlint/top-level': 18.4.3 '@commitlint/types': 18.4.3 - fs-extra: 11.1.1 + fs-extra: 11.2.0 git-raw-commits: 2.0.11 minimist: 1.2.8 dev: true @@ -1447,8 +1447,8 @@ packages: universal-user-agent: 6.0.1 dev: true - /@octokit/endpoint@9.0.3: - resolution: {integrity: sha512-TXVX57fJV7SA6LvRkeXPIOBr8AKvKDlhwNVBP/26O9DjIFi+CkYZGFLP9WtPdVOicRIhqGHxBCC6Fdj5AWWGgQ==} + /@octokit/endpoint@9.0.4: + resolution: {integrity: sha512-DWPLtr1Kz3tv8L0UvXTDP1fNwM0S+z6EJpRcvH66orY6Eld4XBMCSYsaWp4xIm61jTWxK68BrR7ibO+vSDnZqw==} engines: {node: '>= 18'} dependencies: '@octokit/types': 12.3.0 @@ -1510,7 +1510,7 @@ packages: resolution: {integrity: sha512-YhPaGml3ncZC1NfXpP3WZ7iliL1ap6tLkAp6MvbK2fTTPytzVUyUesBBogcdMm86uRYO5rHaM1xIWxigWZ17MQ==} engines: {node: '>= 18'} dependencies: - '@octokit/endpoint': 9.0.3 + '@octokit/endpoint': 9.0.4 '@octokit/request-error': 5.0.1 '@octokit/types': 12.3.0 universal-user-agent: 6.0.1 @@ -4839,6 +4839,15 @@ packages: jsonfile: 6.1.0 universalify: 2.0.1 + /fs-extra@11.2.0: + resolution: {integrity: sha512-PmDi3uwK5nFuXh7XDTlVnS17xJS7vW36is2+w3xcv8SVxiB4NyATf4ctkVY5bkSjX0Y4nbvZCq1/EjtEyr9ktw==} + engines: {node: '>=14.14'} + dependencies: + graceful-fs: 4.2.11 + jsonfile: 6.1.0 + universalify: 2.0.1 + dev: true + /fs-extra@8.1.0: resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==} engines: {node: '>=6 <7 || >=8'} @@ -9305,8 +9314,8 @@ packages: /tslib@2.6.2: resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==} - /tsx@4.5.0: - resolution: {integrity: sha512-hgxdziy9KLaHh9KE+a6tIZFP6kb0MLq/1D0sJVifbGP4QVEYhy6+2FNn7MyCm1pMc63p9CW/L1OzdqTNPxs6rg==} + /tsx@4.6.0: + resolution: {integrity: sha512-HLHaDQ78mly4Pd5co6tWQOiNVYoYYAPUcwSSZK4bcs3zSEsg+/67LS/ReHook0E7DKPfe1J5jc0ocIhUrnaR4w==} engines: {node: '>=18.0.0'} hasBin: true dependencies: diff --git a/src/charging-station/Bootstrap.ts b/src/charging-station/Bootstrap.ts index 710d2c89..109e1170 100644 --- a/src/charging-station/Bootstrap.ts +++ b/src/charging-station/Bootstrap.ts @@ -55,7 +55,6 @@ export class Bootstrap extends EventEmitter { private static instance: Bootstrap | null = null; public numberOfChargingStations!: number; public numberOfChargingStationTemplates!: number; - private workerConfiguration?: WorkerConfiguration; private workerImplementation?: WorkerAbstract; private readonly uiServer?: AbstractUIServer; private storage?: Storage; @@ -104,10 +103,10 @@ export class Bootstrap extends EventEmitter { if (this.starting === false) { this.starting = true; this.initializeCounters(); - this.workerConfiguration = Configuration.getConfigurationSection( + const workerConfiguration = Configuration.getConfigurationSection( ConfigurationSection.worker, ); - this.initializeWorkerImplementation(this.workerConfiguration); + this.initializeWorkerImplementation(workerConfiguration); await this.workerImplementation?.start(); const performanceStorageConfiguration = Configuration.getConfigurationSection( @@ -145,13 +144,13 @@ export class Bootstrap extends EventEmitter { this.version } started with ${this.numberOfChargingStations.toString()} charging station(s) from ${this.numberOfChargingStationTemplates.toString()} configured charging station template(s) and ${ Configuration.workerDynamicPoolInUse() - ? `${this.workerConfiguration.poolMinSize?.toString()}/` + ? `${workerConfiguration.poolMinSize?.toString()}/` : '' }${this.workerImplementation?.size}${ Configuration.workerPoolInUse() - ? `/${this.workerConfiguration.poolMaxSize?.toString()}` + ? `/${workerConfiguration.poolMaxSize?.toString()}` : '' - } worker(s) concurrently running in '${this.workerConfiguration.processType}' mode${ + } worker(s) concurrently running in '${workerConfiguration.processType}' mode${ !isNullOrUndefined(this.workerImplementation?.maxElementsPerWorker) ? ` (${this.workerImplementation?.maxElementsPerWorker} charging station(s) per worker)` : '' @@ -195,7 +194,6 @@ export class Bootstrap extends EventEmitter { } await this.workerImplementation?.stop(); delete this.workerImplementation; - delete this.workerConfiguration; this.uiServer?.stop(); await this.storage?.close(); delete this.storage; -- 2.34.1