From 4347fbe4b583b8cbdc5591721baf61096f93aefb Mon Sep 17 00:00:00 2001 From: Casper Warden <216465704+casperwardensl@users.noreply.github.com> Date: Mon, 18 Nov 2024 17:50:30 +0000 Subject: [PATCH] Fix circuit disconnect notification --- lib/Bot.ts | 13 ++++++++++++- package.json | 2 +- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/lib/Bot.ts b/lib/Bot.ts index 57fcdda..b61e198 100644 --- a/lib/Bot.ts +++ b/lib/Bot.ts @@ -364,6 +364,18 @@ export class Bot this.ping = setInterval(async() => { + const now = new Date().getTime(); + if (now - this.lastSuccessfulPing > 120 * 1000) + { + if (this.ping !== null) + { + clearInterval(this.ping); + this.ping = null; + this.disconnected(false, 'Disconnected from the simulator'); + } + return; + } + this.pingNumber++; if (this.pingNumber % 12 === 0 && this.stay) { @@ -418,7 +430,6 @@ export class Bot // No action needed }).catch(() => { - console.error('Timeout waiting for ping from the simulator - possible disconnection') }); diff --git a/package.json b/package.json index 250c8b4..59c6d2c 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@caspertech/node-metaverse", - "version": "0.7.29", + "version": "0.7.40", "description": "A node.js interface for Second Life.", "main": "dist/lib/index.js", "types": "dist/lib/index.d.ts",