diff --git a/package-lock.json b/package-lock.json index 35552f994..cf78c45c6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -13,7 +13,7 @@ "@connectrpc/connect": "^1.6.0", "@connectrpc/connect-web": "^1.6.0", "bsonfy": "^1.0.2", - "exponential-backoff": "^3.1.2" + "exponential-backoff": "^3.1.3" }, "devDependencies": { "@bufbuild/buf": "^1.15.0-1", @@ -2877,9 +2877,9 @@ } }, "node_modules/exponential-backoff": { - "version": "3.1.2", - "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.2.tgz", - "integrity": "sha512-8QxYTVXUkuy7fIIoitQkPwGonB8F3Zj8eEO8Sqg9Zv/bkI7RJAzowee4gr81Hak/dUTpA2Z7VfQgoijjPNlUZA==", + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.3.tgz", + "integrity": "sha512-ZgEeZXj30q+I0EN+CbSSpIyPaJ5HVQD18Z1m+u1FXbAeT94mr1zw50q4q6jiiC447Nl/YTcIYSAftiGqetwXCA==", "license": "Apache-2.0" }, "node_modules/fast-deep-equal": { diff --git a/package.json b/package.json index 18e8b2e88..7567b7e73 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,7 @@ "@connectrpc/connect": "^1.6.0", "@connectrpc/connect-web": "^1.6.0", "bsonfy": "^1.0.2", - "exponential-backoff": "^3.1.2" + "exponential-backoff": "^3.1.3" }, "devDependencies": { "@bufbuild/buf": "^1.15.0-1", diff --git a/src/robot/client.ts b/src/robot/client.ts index b0fbc3f9d..9e9246251 100644 --- a/src/robot/client.ts +++ b/src/robot/client.ts @@ -351,9 +351,18 @@ export class RobotClient extends EventDispatcher implements Robot { // eslint-disable-next-line no-console console.debug('Reconnected successfully!'); }) - .catch(() => { + .catch((error) => { + if ( + this.reconnectMaxAttempts !== undefined && + this.currentRetryAttempt >= this.reconnectMaxAttempts + ) { + // eslint-disable-next-line no-console + console.debug(`Reached max attempts: ${this.reconnectMaxAttempts}`); + return; + } + // eslint-disable-next-line no-console - console.debug(`Reached max attempts: ${this.reconnectMaxAttempts}`); + console.error(error); }); }