From: Jérôme Benoit Date: Mon, 5 Feb 2024 11:44:16 +0000 (+0100) Subject: fix: ensure worket set stop event is emitted once X-Git-Tag: v1.2.35~4 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=4f02e9b46125abbf1decd1c9762c80d568a633f7;p=e-mobility-charging-stations-simulator.git fix: ensure worket set stop event is emitted once Signed-off-by: Jérôme Benoit --- diff --git a/package.json b/package.json index 6c700194..e2d7dcb3 100644 --- a/package.json +++ b/package.json @@ -92,10 +92,10 @@ } }, "dependencies": { - "@mikro-orm/core": "^6.0.7", - "@mikro-orm/mariadb": "^6.0.7", - "@mikro-orm/reflection": "^6.0.7", - "@mikro-orm/sqlite": "^6.0.7", + "@mikro-orm/core": "^6.1.0", + "@mikro-orm/mariadb": "^6.1.0", + "@mikro-orm/reflection": "^6.1.0", + "@mikro-orm/sqlite": "^6.1.0", "ajv": "^8.12.0", "ajv-formats": "^2.1.1", "basic-ftp": "^5.0.4", @@ -119,7 +119,7 @@ "devDependencies": { "@commitlint/cli": "^18.6.0", "@commitlint/config-conventional": "^18.6.0", - "@mikro-orm/cli": "^6.0.7", + "@mikro-orm/cli": "^6.1.0", "@release-it/bumper": "^6.0.1", "@types/node": "^20.11.16", "@types/tar": "^6.1.11", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a956f5a1..d30be30e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -15,17 +15,17 @@ overrides: dependencies: '@mikro-orm/core': - specifier: ^6.0.7 - version: 6.0.7 + specifier: ^6.1.0 + version: 6.1.0 '@mikro-orm/mariadb': - specifier: ^6.0.7 - version: 6.0.7(@mikro-orm/core@6.0.7) + specifier: ^6.1.0 + version: 6.1.0(@mikro-orm/core@6.1.0) '@mikro-orm/reflection': - specifier: ^6.0.7 - version: 6.0.7(@mikro-orm/core@6.0.7) + specifier: ^6.1.0 + version: 6.1.0(@mikro-orm/core@6.1.0) '@mikro-orm/sqlite': - specifier: ^6.0.7 - version: 6.0.7(@mikro-orm/core@6.0.7) + specifier: ^6.1.0 + version: 6.1.0(@mikro-orm/core@6.1.0) ajv: specifier: ^8.12.0 version: 8.12.0 @@ -88,8 +88,8 @@ devDependencies: specifier: ^18.6.0 version: 18.6.0 '@mikro-orm/cli': - specifier: ^6.0.7 - version: 6.0.7 + specifier: ^6.1.0 + version: 6.1.0 '@release-it/bumper': specifier: ^6.0.1 version: 6.0.1(release-it@17.0.3) @@ -1171,14 +1171,14 @@ packages: resolution: {integrity: sha512-9b8mPpKrfeGRuhFH5iO1iwCLeIIsV6+H1sRfxbkoGXIyQE2BTsPd9zqSqQJ+pv5sJ/hT5M1zvOFL02MnEezFug==} dev: true - /@mikro-orm/cli@6.0.7: - resolution: {integrity: sha512-/C5zTyAOh/32D3/FIsRwN83sTlIjgklBWfcEd4/bA2pSZ4gB2ViUgvE+XauWni84k7BxFGYYpxQjRMBwqx5Wyw==} + /@mikro-orm/cli@6.1.0: + resolution: {integrity: sha512-uUbbSGPN9fuJEjtfQJ8RiTIAcf+kLgEinkvp7ywycsX02gXYtOpTqtvXm5Mj4Zju7XXpXcqJDlxav++GNR0gmg==} engines: {node: '>= 18.12.0'} hasBin: true dependencies: '@jercle/yargonaut': 1.1.5 - '@mikro-orm/core': 6.0.7 - '@mikro-orm/knex': 6.0.7(@mikro-orm/core@6.0.7)(sqlite3@5.1.7) + '@mikro-orm/core': 6.1.0 + '@mikro-orm/knex': 6.1.0(@mikro-orm/core@6.1.0)(sqlite3@5.1.7) fs-extra: 11.2.0 tsconfig-paths: 4.2.0 yargs: 17.7.2 @@ -1193,8 +1193,8 @@ packages: - tedious dev: true - /@mikro-orm/core@6.0.7: - resolution: {integrity: sha512-YKBS2apwK9vALBA/mK+6u/Xa8At4mQ/McdwoqjMcAA3s5SaFlNLZmb2TIaZYBCJA0FKUlkIvzW7MuFYkJud9tA==} + /@mikro-orm/core@6.1.0: + resolution: {integrity: sha512-jP0UzzpyWuE/jxXMesix16SLCsg8nBbogSuKKx3HQOnjd1xafPo4cCjaNFLlmSQbllbEbgTgsvy8Zh354A0X2g==} engines: {node: '>= 18.12.0'} dependencies: dataloader: 2.2.2 @@ -1202,16 +1202,16 @@ packages: esprima: 4.0.1 fs-extra: 11.2.0 globby: 11.1.0 - mikro-orm: 6.0.7 + mikro-orm: 6.1.0 reflect-metadata: 0.2.1 - /@mikro-orm/knex@6.0.7(@mikro-orm/core@6.0.7)(sqlite3@5.1.7): - resolution: {integrity: sha512-dTHQ8FuDum+u/N2jonX+L6wTwUfkjow1n95xez9Dys6wkdq4LUBx5QXJt/4pBIEB9t2MbR2G5+XkAXz+DPIw2Q==} + /@mikro-orm/knex@6.1.0(@mikro-orm/core@6.1.0)(sqlite3@5.1.7): + resolution: {integrity: sha512-GEY/ywUxfo/te+1STi8yVXRNUqqS76QC0doDwrh2JHC73iq5tuuq7Nfw7VdLU6QGbarzUIhJOQHclfwTdZuHlQ==} engines: {node: '>= 18.12.0'} peerDependencies: '@mikro-orm/core': ^6.0.0 dependencies: - '@mikro-orm/core': 6.0.7 + '@mikro-orm/core': 6.1.0 fs-extra: 11.2.0 knex: 3.1.0(sqlite3@5.1.7) sqlstring: 2.3.3 @@ -1225,14 +1225,14 @@ packages: - supports-color - tedious - /@mikro-orm/mariadb@6.0.7(@mikro-orm/core@6.0.7): - resolution: {integrity: sha512-yBZXLTQXzZcrsmdRIRUK4F3L1myzj93Z8ekT4wxyX/mEJkaXQIMwb/S7PwZY2jomkZEsGLp0oANq3iuT4/rhpQ==} + /@mikro-orm/mariadb@6.1.0(@mikro-orm/core@6.1.0): + resolution: {integrity: sha512-bMR2keGwVgstbWo+c6Dee5oPuoG3/8AlheUtq6D1SbD1PiQT4EoJ48knejLyxcqc/uBW35uIXZ0xnE0l3rsuCA==} engines: {node: '>= 18.12.0'} peerDependencies: '@mikro-orm/core': ^6.0.0 dependencies: - '@mikro-orm/core': 6.0.7 - '@mikro-orm/knex': 6.0.7(@mikro-orm/core@6.0.7)(sqlite3@5.1.7) + '@mikro-orm/core': 6.1.0 + '@mikro-orm/knex': 6.1.0(@mikro-orm/core@6.1.0)(sqlite3@5.1.7) mariadb: 2.5.6 transitivePeerDependencies: - better-sqlite3 @@ -1245,25 +1245,25 @@ packages: - tedious dev: false - /@mikro-orm/reflection@6.0.7(@mikro-orm/core@6.0.7): - resolution: {integrity: sha512-z+NzEkes9sZhBgIuk+F2tZybyeF8UAz+fLVaJI+1UOGAFBgo3Y8Z8tI03okTmy2bWuWzti2OJOHdv3XUJkFYRA==} + /@mikro-orm/reflection@6.1.0(@mikro-orm/core@6.1.0): + resolution: {integrity: sha512-AzYt/l5FTNjc5seYPNBAeJUg3UoJHFxvwXwU0//BnEstn4b0c3/nnVYJeEO+1LgyPNQi/v/j5kT0w3Q2WExlbA==} engines: {node: '>= 18.12.0'} peerDependencies: '@mikro-orm/core': ^6.0.0 dependencies: - '@mikro-orm/core': 6.0.7 + '@mikro-orm/core': 6.1.0 globby: 11.1.0 ts-morph: 21.0.1 dev: false - /@mikro-orm/sqlite@6.0.7(@mikro-orm/core@6.0.7): - resolution: {integrity: sha512-bSG4hVkYftK/6zn2hC6iMh4kzAg7PcjQALX+pL6uZ/049uGiAFfH+p+AAv65Twiqxm+GmGksmqIfOGU7Rn/gMw==} + /@mikro-orm/sqlite@6.1.0(@mikro-orm/core@6.1.0): + resolution: {integrity: sha512-JGc8/Xae6o6LZswKQuRvk5/zMS50l53a0iHG4TMX/QCXYYnuuvEfhcPfRObHVzyBCjBGPXbt9t5ZDUmRYbe7pw==} engines: {node: '>= 18.12.0'} peerDependencies: '@mikro-orm/core': ^6.0.0 dependencies: - '@mikro-orm/core': 6.0.7 - '@mikro-orm/knex': 6.0.7(@mikro-orm/core@6.0.7)(sqlite3@5.1.7) + '@mikro-orm/core': 6.1.0 + '@mikro-orm/knex': 6.1.0(@mikro-orm/core@6.1.0)(sqlite3@5.1.7) fs-extra: 11.2.0 sqlite3: 5.1.7 sqlstring-sqlite: 0.1.1 @@ -2083,6 +2083,17 @@ packages: resolution: {integrity: sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==} engines: {node: '>=8'} + /array.prototype.filter@1.0.3: + resolution: {integrity: sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + es-array-method-boxes-properly: 1.0.0 + is-string: 1.0.7 + dev: true + /array.prototype.findlastindex@1.2.3: resolution: {integrity: sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==} engines: {node: '>= 0.4'} @@ -2125,14 +2136,15 @@ packages: is-string: 1.0.7 dev: true - /arraybuffer.prototype.slice@1.0.2: - resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} + /arraybuffer.prototype.slice@1.0.3: + resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} engines: {node: '>= 0.4'} dependencies: array-buffer-byte-length: 1.0.1 call-bind: 1.0.5 define-properties: 1.2.1 es-abstract: 1.22.3 + es-errors: 1.3.0 get-intrinsic: 1.2.3 is-array-buffer: 3.0.4 is-shared-array-buffer: 1.0.2 @@ -3806,7 +3818,7 @@ packages: engines: {node: '>= 0.4'} dependencies: array-buffer-byte-length: 1.0.1 - arraybuffer.prototype.slice: 1.0.2 + arraybuffer.prototype.slice: 1.0.3 available-typed-arrays: 1.0.6 call-bind: 1.0.5 es-set-tostringtag: 2.0.2 @@ -3850,8 +3862,8 @@ packages: resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} dev: true - /es-errors@1.0.0: - resolution: {integrity: sha512-yHV74THqMJUyFKkHyN7hyENcEZM3Dj2a2IrdClY+IT4BFQHkIVwlh8s6uZfjsFydMdNHv0F5mWgAA3ajFbsvVQ==} + /es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} dev: true @@ -4235,7 +4247,7 @@ packages: is-glob: 4.0.3 minimatch: 3.1.2 object.fromentries: 2.0.7 - object.groupby: 1.0.1 + object.groupby: 1.0.2 object.values: 1.1.7 semver: 7.5.4 tsconfig-paths: 3.15.0 @@ -4839,7 +4851,7 @@ packages: resolution: {integrity: sha512-JIcZczvcMVE7AUOP+X72bh8HqHBRxFdz5PDHYtNG/lE3yk9b3KZBJlwFcTyPYjg3L4RLLmZJzvjxhaZVapxFrQ==} engines: {node: '>= 0.4'} dependencies: - es-errors: 1.0.0 + es-errors: 1.3.0 function-bind: 1.1.2 has-proto: 1.0.1 has-symbols: 1.0.3 @@ -6605,8 +6617,8 @@ packages: braces: 3.0.2 picomatch: 2.3.1 - /mikro-orm@6.0.7: - resolution: {integrity: sha512-xroA0FDu6EndAj3e5HayA2pFyJ1Fnn63X5jxjcK+cPM0/0p81YELkIACeNmg3+S1A2JDm5eLVvkMrmwi73DvjA==} + /mikro-orm@6.1.0: + resolution: {integrity: sha512-NLdDdAE6rAj3886am2GSz7E7ntSXVTNDLGdU349q4PfkRFZniZBmc16bWW0JNBhZYZYkBVqfdm2Y2h39iqmI4g==} engines: {node: '>= 18.12.0'} /miller-rabin@4.0.1: @@ -7276,13 +7288,14 @@ packages: es-abstract: 1.22.3 dev: true - /object.groupby@1.0.1: - resolution: {integrity: sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==} + /object.groupby@1.0.2: + resolution: {integrity: sha512-bzBq58S+x+uo0VjurFT0UktpKHOZmv4/xePiOA1nbB9pMqpGK7rUPNgf+1YC+7mE+0HzhTMqNUuCqvKhj6FnBw==} dependencies: + array.prototype.filter: 1.0.3 call-bind: 1.0.5 define-properties: 1.2.1 es-abstract: 1.22.3 - get-intrinsic: 1.2.3 + es-errors: 1.3.0 dev: true /object.values@1.1.7: diff --git a/src/worker/WorkerSet.ts b/src/worker/WorkerSet.ts index f1ab1cf5..f10ca9c8 100644 --- a/src/worker/WorkerSet.ts +++ b/src/worker/WorkerSet.ts @@ -52,6 +52,7 @@ export class WorkerSet extends WorkerAbstract { version: workerSetVersion, type: 'set', worker: 'thread', + started: this.started, size: this.size, elementsExecuting: [...this.workerSet].reduce( (accumulator, workerSetElement) => accumulator + workerSetElement.numberOfWorkerElements, @@ -93,11 +94,11 @@ export class WorkerSet extends WorkerAbstract { }) await worker.terminate() await waitWorkerExit - this.emitter?.emit(WorkerSetEvents.stopped, this.info) - this.emitter?.emitDestroy() - this.emitter?.removeAllListeners() - this.started = false } + this.emitter?.emit(WorkerSetEvents.stopped, this.info) + this.emitter?.emitDestroy() + this.emitter?.removeAllListeners() + this.started = false } /** @inheritDoc */ diff --git a/src/worker/WorkerTypes.ts b/src/worker/WorkerTypes.ts index d879ce08..5c8c177f 100644 --- a/src/worker/WorkerTypes.ts +++ b/src/worker/WorkerTypes.ts @@ -13,6 +13,7 @@ export interface SetInfo { version: string type: string worker: string + started: boolean size: number elementsExecuting: number elementsPerWorker: number diff --git a/ui/web/pnpm-lock.yaml b/ui/web/pnpm-lock.yaml index 752799cc..f6a410fd 100644 --- a/ui/web/pnpm-lock.yaml +++ b/ui/web/pnpm-lock.yaml @@ -1399,6 +1399,17 @@ packages: engines: {node: '>=8'} dev: true + /array.prototype.filter@1.0.3: + resolution: {integrity: sha512-VizNcj/RGJiUyQBgzwxzE5oHdeuXY5hSbbmKMlphj1cy1Vl7Pn2asCGbSrru6hSQjmCzqTBPVWAF/whmEOVHbw==} + engines: {node: '>= 0.4'} + dependencies: + call-bind: 1.0.5 + define-properties: 1.2.1 + es-abstract: 1.22.3 + es-array-method-boxes-properly: 1.0.0 + is-string: 1.0.7 + dev: true + /array.prototype.findlastindex@1.2.3: resolution: {integrity: sha512-LzLoiOMAxvy+Gd3BAq3B7VeIgPdo+Q8hthvKtXybMvRV0jrXfJM/t8mw7nNlpEcVlVUnCnM2KSX4XU5HmpodOA==} engines: {node: '>= 0.4'} @@ -1430,14 +1441,15 @@ packages: es-shim-unscopables: 1.0.2 dev: true - /arraybuffer.prototype.slice@1.0.2: - resolution: {integrity: sha512-yMBKppFur/fbHu9/6USUe03bZ4knMYiwFBcyiaXB8Go0qNehwX6inYPzK9U0NeQvGxKthcmHcaR8P5MStSRBAw==} + /arraybuffer.prototype.slice@1.0.3: + resolution: {integrity: sha512-bMxMKAjg13EBSVscxTaYA4mRc5t1UAXa2kXiGTNfZ079HIWXEkKmkgFrh/nJqamaLSrXO5H4WFFkPEaLJWbs3A==} engines: {node: '>= 0.4'} dependencies: array-buffer-byte-length: 1.0.1 call-bind: 1.0.5 define-properties: 1.2.1 es-abstract: 1.22.3 + es-errors: 1.3.0 get-intrinsic: 1.2.3 is-array-buffer: 3.0.4 is-shared-array-buffer: 1.0.2 @@ -1489,7 +1501,7 @@ packages: engines: {node: ^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7} hasBin: true dependencies: - caniuse-lite: 1.0.30001583 + caniuse-lite: 1.0.30001584 electron-to-chromium: 1.4.656 node-releases: 2.0.14 update-browserslist-db: 1.0.13(browserslist@4.22.3) @@ -1518,8 +1530,8 @@ packages: engines: {node: '>=10'} dev: true - /caniuse-lite@1.0.30001583: - resolution: {integrity: sha512-acWTYaha8xfhA/Du/z4sNZjHUWjkiuoAi2LM+T/aL+kemKQgPT1xBb/YKjlQ0Qo8gvbHsGNplrEJ+9G3gL7i4Q==} + /caniuse-lite@1.0.30001584: + resolution: {integrity: sha512-LOz7CCQ9M1G7OjJOF9/mzmqmj3jE/7VOmrfw6Mgs0E8cjOsbRXQJHsPBfmBOXDskXKrHLyyW3n7kpDW/4BsfpQ==} dev: true /chai@4.4.1: @@ -1808,7 +1820,7 @@ packages: engines: {node: '>= 0.4'} dependencies: array-buffer-byte-length: 1.0.1 - arraybuffer.prototype.slice: 1.0.2 + arraybuffer.prototype.slice: 1.0.3 available-typed-arrays: 1.0.6 call-bind: 1.0.5 es-set-tostringtag: 2.0.2 @@ -1848,8 +1860,12 @@ packages: which-typed-array: 1.1.14 dev: true - /es-errors@1.0.0: - resolution: {integrity: sha512-yHV74THqMJUyFKkHyN7hyENcEZM3Dj2a2IrdClY+IT4BFQHkIVwlh8s6uZfjsFydMdNHv0F5mWgAA3ajFbsvVQ==} + /es-array-method-boxes-properly@1.0.0: + resolution: {integrity: sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==} + dev: true + + /es-errors@1.3.0: + resolution: {integrity: sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==} engines: {node: '>= 0.4'} dev: true @@ -2029,7 +2045,7 @@ packages: is-glob: 4.0.3 minimatch: 3.1.2 object.fromentries: 2.0.7 - object.groupby: 1.0.1 + object.groupby: 1.0.2 object.values: 1.1.7 semver: 7.5.4 tsconfig-paths: 3.15.0 @@ -2354,7 +2370,7 @@ packages: resolution: {integrity: sha512-JIcZczvcMVE7AUOP+X72bh8HqHBRxFdz5PDHYtNG/lE3yk9b3KZBJlwFcTyPYjg3L4RLLmZJzvjxhaZVapxFrQ==} engines: {node: '>= 0.4'} dependencies: - es-errors: 1.0.0 + es-errors: 1.3.0 function-bind: 1.1.2 has-proto: 1.0.1 has-symbols: 1.0.3 @@ -3115,13 +3131,14 @@ packages: es-abstract: 1.22.3 dev: true - /object.groupby@1.0.1: - resolution: {integrity: sha512-HqaQtqLnp/8Bn4GL16cj+CUYbnpe1bh0TtEaWvybszDG4tgxCJuRpV8VGuvNaI1fAnI4lUJzDG55MXcOH4JZcQ==} + /object.groupby@1.0.2: + resolution: {integrity: sha512-bzBq58S+x+uo0VjurFT0UktpKHOZmv4/xePiOA1nbB9pMqpGK7rUPNgf+1YC+7mE+0HzhTMqNUuCqvKhj6FnBw==} dependencies: + array.prototype.filter: 1.0.3 call-bind: 1.0.5 define-properties: 1.2.1 es-abstract: 1.22.3 - get-intrinsic: 1.2.3 + es-errors: 1.3.0 dev: true /object.values@1.1.7: