From 6c65a2958d57b4c91a60150c2bf567659b64d4f0 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Mon, 13 Sep 2021 19:07:10 +0200 Subject: [PATCH] Log also ws closing reason MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- package-lock.json | 42 ++++++++++++------------- package.json | 2 +- src/charging-station/ChargingStation.ts | 12 ++++--- src/worker/WorkerDynamicPool.ts | 1 - 4 files changed, 29 insertions(+), 28 deletions(-) diff --git a/package-lock.json b/package-lock.json index ef48b0f5..9bfe0cc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9917,16 +9917,16 @@ } }, "expect": { - "version": "27.1.1", - "resolved": "https://registry.npmjs.org/expect/-/expect-27.1.1.tgz", - "integrity": "sha512-JQAzp0CJoFFHF1RnOtrMUNMdsfx/Tl0+FhRzVl8q0fa23N+JyWdPXwb3T5rkHCvyo9uttnK7lVdKCBl1b/9EDw==", + "version": "27.2.0", + "resolved": "https://registry.npmjs.org/expect/-/expect-27.2.0.tgz", + "integrity": "sha512-oOTbawMQv7AK1FZURbPTgGSzmhxkjFzoARSvDjOMnOpeWuYQx1tP6rXu9MIX5mrACmyCAM7fSNP8IJO2f1p0CQ==", "dev": true, "requires": { "@jest/types": "^27.1.1", "ansi-styles": "^5.0.0", "jest-get-type": "^27.0.6", - "jest-matcher-utils": "^27.1.1", - "jest-message-util": "^27.1.1", + "jest-matcher-utils": "^27.2.0", + "jest-message-util": "^27.2.0", "jest-regex-util": "^27.0.6" }, "dependencies": { @@ -12260,15 +12260,15 @@ } }, "jest-diff": { - "version": "27.1.1", - "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.1.1.tgz", - "integrity": "sha512-m/6n5158rqEriTazqHtBpOa2B/gGgXJijX6nsEgZfbJ/3pxQcdpVXBe+FP39b1dxWHyLVVmuVXddmAwtqFO4Lg==", + "version": "27.2.0", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-27.2.0.tgz", + "integrity": "sha512-QSO9WC6btFYWtRJ3Hac0sRrkspf7B01mGrrQEiCW6TobtViJ9RWL0EmOs/WnBsZDsI/Y2IoSHZA2x6offu0sYw==", "dev": true, "requires": { "chalk": "^4.0.0", "diff-sequences": "^27.0.6", "jest-get-type": "^27.0.6", - "pretty-format": "^27.1.1" + "pretty-format": "^27.2.0" } }, "jest-get-type": { @@ -12278,21 +12278,21 @@ "dev": true }, "jest-matcher-utils": { - "version": "27.1.1", - "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.1.1.tgz", - "integrity": "sha512-Q1a10w9Y4sh0wegkdP6reQOa/Dtz7nAvDqBgrat1ItZAUvk4jzXAqyhXPu/ZuEtDaXaNKpdRPRQA8bvkOh2Eaw==", + "version": "27.2.0", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-27.2.0.tgz", + "integrity": "sha512-F+LG3iTwJ0gPjxBX6HCyrARFXq6jjiqhwBQeskkJQgSLeF1j6ui1RTV08SR7O51XTUhtc8zqpDj8iCG4RGmdKw==", "dev": true, "requires": { "chalk": "^4.0.0", - "jest-diff": "^27.1.1", + "jest-diff": "^27.2.0", "jest-get-type": "^27.0.6", - "pretty-format": "^27.1.1" + "pretty-format": "^27.2.0" } }, "jest-message-util": { - "version": "27.1.1", - "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.1.1.tgz", - "integrity": "sha512-b697BOJV93+AVGvzLRtVZ0cTVRbd59OaWnbB2D75GRaIMc4I+Z9W0wHxbfjW01JWO+TqqW4yevT0aN7Fd0XWng==", + "version": "27.2.0", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-27.2.0.tgz", + "integrity": "sha512-y+sfT/94CiP8rKXgwCOzO1mUazIEdEhrLjuiu+RKmCP+8O/TJTSne9dqQRbFIHBtlR2+q7cddJlWGir8UATu5w==", "dev": true, "requires": { "@babel/code-frame": "^7.12.13", @@ -12301,7 +12301,7 @@ "chalk": "^4.0.0", "graceful-fs": "^4.2.4", "micromatch": "^4.0.4", - "pretty-format": "^27.1.1", + "pretty-format": "^27.2.0", "slash": "^3.0.0", "stack-utils": "^2.0.3" }, @@ -15721,9 +15721,9 @@ "dev": true }, "pretty-format": { - "version": "27.1.1", - "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.1.1.tgz", - "integrity": "sha512-zdBi/xlstKJL42UH7goQti5Hip/B415w1Mfj+WWWYMBylAYtKESnXGUtVVcMVid9ReVjypCotUV6CEevYPHv2g==", + "version": "27.2.0", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.2.0.tgz", + "integrity": "sha512-KyJdmgBkMscLqo8A7K77omgLx5PWPiXJswtTtFV7XgVZv2+qPk6UivpXXO+5k6ZEbWIbLoKdx1pZ6ldINzbwTA==", "dev": true, "requires": { "@jest/types": "^27.1.1", diff --git a/package.json b/package.json index ba6c7fdb..8dcf8d96 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,7 @@ "eslint-plugin-import": "^2.24.2", "eslint-plugin-jsdoc": "^36.1.0", "eslint-plugin-node": "^11.1.0", - "expect": "^27.1.1", + "expect": "^27.2.0", "mocha": "^9.1.1", "mochawesome": "^6.2.2", "npm-check": "^5.9.2", diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 72c781fc..103a96f0 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -631,15 +631,17 @@ export default class ChargingStation { this.hasSocketRestarted = false; } - private async onClose(code: number): Promise { + private async onClose(code: number, reason: string): Promise { switch (code) { - case WebSocketCloseEventStatusCode.CLOSE_NORMAL: // Normal close + // Normal close + case WebSocketCloseEventStatusCode.CLOSE_NORMAL: case WebSocketCloseEventStatusCode.CLOSE_NO_STATUS: - logger.info(`${this.logPrefix()} Socket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}'`); + logger.info(`${this.logPrefix()} Socket normally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}' and reason '${reason}'`); this.autoReconnectRetryCount = 0; break; - default: // Abnormal close - logger.error(`${this.logPrefix()} Socket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)}'`); + // Abnormal close + default: + logger.error(`${this.logPrefix()} Socket abnormally closed with status '${Utils.getWebSocketCloseEventStatusString(code)} and reason '${reason}'`); await this.reconnect(code); break; } diff --git a/src/worker/WorkerDynamicPool.ts b/src/worker/WorkerDynamicPool.ts index 044938d4..e5119ff6 100644 --- a/src/worker/WorkerDynamicPool.ts +++ b/src/worker/WorkerDynamicPool.ts @@ -47,7 +47,6 @@ export default class WorkerDynamicPool extends WorkerAbstract { * @returns * @public */ - // eslint-disable-next-line @typescript-eslint/require-await public async stop(): Promise { return this.pool.destroy(); } -- 2.34.1