diff --git a/dist/src/utils/tribes.js b/dist/src/utils/tribes.js index b9de2c9a7..5d6e543fb 100644 --- a/dist/src/utils/tribes.js +++ b/dist/src/utils/tribes.js @@ -78,9 +78,17 @@ function initializeClient(pubkey, host, onMessage) { console.log("[tribes] try to connect:", url); cl.on("connect", function () { return __awaiter(this, void 0, void 0, function* () { + // first check if its already connected to this host (in case it takes a long time) + connected = true; + if (clients[pubkey] && clients[pubkey][host] && clients[pubkey][host].connected) { + resolve(clients[pubkey][host]); + return; + } if (logger_1.logging.Tribes) console.log("[tribes] connected!"); - connected = true; + if (!clients[pubkey]) + clients[pubkey] = {}; + clients[pubkey][host] = cl; // ADD TO MAIN STATE cl.on("close", function (e) { if (logger_1.logging.Tribes) console.log("[tribes] CLOSE", e); @@ -121,7 +129,7 @@ function initializeClient(pubkey, host, onMessage) { if (!connected) { reconnect(); } - yield helpers_1.sleep(5000 + Math.round(Math.random() * 8000)); + yield helpers_1.sleep(5000 + Math.round(Math.random() * 8)); } })); }); @@ -132,9 +140,6 @@ function lazyClient(pubkey, host, onMessage) { return clients[pubkey][host]; } const cl = yield initializeClient(pubkey, host, onMessage); - if (!clients[pubkey]) - clients[pubkey] = {}; - clients[pubkey][host] = cl; // ADD TO MAIN STATE return cl; }); } diff --git a/dist/src/utils/tribes.js.map b/dist/src/utils/tribes.js.map index bfa274bbd..d6563ca31 100644 --- a/dist/src/utils/tribes.js.map +++ b/dist/src/utils/tribes.js.map @@ -1 +1 @@ -{"version":3,"file":"tribes.js","sourceRoot":"","sources":["../../../src/utils/tribes.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,iCAAiC;AACjC,qCAAqC;AACrC,mCAAmC;AACnC,6BAA6B;AAE7B,2CAA+B;AAC/B,sCAA8C;AAC9C,2CAAwD;AAO/C,4FAPc,uBAAW,OAOd;AANpB,qCAAsC;AACtC,mCAAkC;AAClC,yCAA+B;AAC/B,qCAAgC;AAChC,wCAAmC;AAInC,MAAM,MAAM,GAAG,mBAAU,EAA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AAC,KAAK,EAAE,QAAQ;;QACzC,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,KAAK,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE;YACjD,MAAM,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC;SAC5C;IACH,CAAC;CAAA"} \ No newline at end of file diff --git a/src/utils/tribes.ts b/src/utils/tribes.ts index e0c06000f..76ecd66e9 100644 --- a/src/utils/tribes.ts +++ b/src/utils/tribes.ts @@ -65,8 +65,15 @@ async function initializeClient(pubkey, host, onMessage): Promise { }); if(logging.Tribes) console.log("[tribes] try to connect:", url); cl.on("connect", async function () { - if(logging.Tribes) console.log("[tribes] connected!"); + // first check if its already connected to this host (in case it takes a long time) connected = true + if (clients[pubkey] && clients[pubkey][host] && clients[pubkey][host].connected) { + resolve(clients[pubkey][host]); + return + } + if(logging.Tribes) console.log("[tribes] connected!"); + if (!clients[pubkey]) clients[pubkey] = {}; + clients[pubkey][host] = cl; // ADD TO MAIN STATE cl.on("close", function (e) { if(logging.Tribes) console.log("[tribes] CLOSE", e); // setTimeout(() => reconnect(), 2000); @@ -98,7 +105,7 @@ async function initializeClient(pubkey, host, onMessage): Promise { if(!connected) { reconnect(); } - await sleep(5000 + Math.round(Math.random()*8000)) + await sleep(5000 + Math.round(Math.random()*8)) } }); } @@ -112,8 +119,6 @@ async function lazyClient( return clients[pubkey][host]; } const cl = await initializeClient(pubkey, host, onMessage); - if (!clients[pubkey]) clients[pubkey] = {}; - clients[pubkey][host] = cl; // ADD TO MAIN STATE return cl; }