Log also ws closing reason
authorJérôme Benoit <jerome.benoit@sap.com>
Mon, 13 Sep 2021 17:07:10 +0000 (19:07 +0200)
committerJérôme Benoit <jerome.benoit@sap.com>
Mon, 13 Sep 2021 17:07:10 +0000 (19:07 +0200)
Signed-off-by: Jérôme Benoit <jerome.benoit@sap.com>
package-lock.json
package.json
src/charging-station/ChargingStation.ts
src/worker/WorkerDynamicPool.ts

index ef48b0f5ca853114870bf1cbd7bd83bdd18632f8..9bfe0cc06c243bd5eee799a59871e7d6077a20fe 100644 (file)
       }
     },
     "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": {
       }
     },
     "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": {
       "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",
         "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"
       },
       "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",
index ba6c7fdbbc5fad57ddf3eb5258bb535f1babe8f4..8dcf8d96bc36d124942817c7246171b4b2bea57a 100644 (file)
     "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",
index 72c781fc4ddf2b1a8b10b68f21c067ccb8ab938f..103a96f0bdc970b003169adccb801009a4d1c57b 100644 (file)
@@ -631,15 +631,17 @@ export default class ChargingStation {
     this.hasSocketRestarted = false;
   }
 
-  private async onClose(code: number): Promise<void> {
+  private async onClose(code: number, reason: string): Promise<void> {
     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;
     }
index 044938d432734f9762f4ffe7e4bb7244e3f74fd5..e5119ff6a0c32020dbabdd4a38ca5ae93a700e0d 100644 (file)
@@ -47,7 +47,6 @@ export default class WorkerDynamicPool<T> extends WorkerAbstract {
    * @returns
    * @public
    */
-  // eslint-disable-next-line @typescript-eslint/require-await
   public async stop(): Promise<void> {
     return this.pool.destroy();
   }