From ec6a62d803c7192e42f9ee6ee49884e45157dac3 Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Wed, 13 Sep 2023 17:00:53 +0300 Subject: [PATCH 1/3] Edit interval time & condition --- packages/rmb_direct_client/lib/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rmb_direct_client/lib/client.ts b/packages/rmb_direct_client/lib/client.ts index c8b077ae27..7150dc7da9 100644 --- a/packages/rmb_direct_client/lib/client.ts +++ b/packages/rmb_direct_client/lib/client.ts @@ -174,14 +174,14 @@ class Client { waitForOpenConnection() { return new Promise((resolve, reject) => { const maxNumberOfAttempts = 10; - const intervalTime = 300; //ms + const intervalTime = 1000; //ms let currentAttempt = 0; const interval = setInterval(() => { if (currentAttempt > maxNumberOfAttempts - 1) { clearInterval(interval); reject(new Error({ message: "Maximum number of attempts exceeded" })); - } else if (this.con.readyState === this.con.OPEN) { + } else if (this.con && this.con.readyState === this.con.OPEN) { clearInterval(interval); resolve("connected"); } From 8279f1c08be42cabf29e4fb0630b4f32050f110c Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Wed, 13 Sep 2023 17:03:08 +0300 Subject: [PATCH 2/3] edit interval time & max number of attempts --- packages/rmb_direct_client/lib/client.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/rmb_direct_client/lib/client.ts b/packages/rmb_direct_client/lib/client.ts index 7150dc7da9..c4666b7c38 100644 --- a/packages/rmb_direct_client/lib/client.ts +++ b/packages/rmb_direct_client/lib/client.ts @@ -173,8 +173,8 @@ class Client { } waitForOpenConnection() { return new Promise((resolve, reject) => { - const maxNumberOfAttempts = 10; - const intervalTime = 1000; //ms + const maxNumberOfAttempts = 20; + const intervalTime = 500; //ms let currentAttempt = 0; const interval = setInterval(() => { From 465e3a2f32c98abf7520cea401531419d3be9a76 Mon Sep 17 00:00:00 2001 From: zaelgohary Date: Thu, 14 Sep 2023 14:29:55 +0300 Subject: [PATCH 3/3] remove unused import --- packages/rmb_direct_client/lib/client.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/rmb_direct_client/lib/client.ts b/packages/rmb_direct_client/lib/client.ts index c4666b7c38..e9c0065b92 100644 --- a/packages/rmb_direct_client/lib/client.ts +++ b/packages/rmb_direct_client/lib/client.ts @@ -1,5 +1,4 @@ import { Keyring } from "@polkadot/api"; -import { ApiPromise, WsProvider } from "@polkadot/api"; import { KeyringPair } from "@polkadot/keyring/types"; import { KeypairType } from "@polkadot/util-crypto/types"; import { waitReady } from "@polkadot/wasm-crypto";