From 9474688e8a46903fd02a51674a2df80d28894462 Mon Sep 17 00:00:00 2001 From: HF Date: Mon, 5 Feb 2024 11:49:47 +0100 Subject: [PATCH] make shards ping their own text listener channels --- src/components/windows/Help.jsx | 1 - src/socket/MessageBroker.js | 7 +++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/components/windows/Help.jsx b/src/components/windows/Help.jsx index ee4800c..0c85253 100644 --- a/src/components/windows/Help.jsx +++ b/src/components/windows/Help.jsx @@ -33,7 +33,6 @@ const Help = () => { const mouseSymbol = ; const touchSymbol = ; const bindShift = ⇧ {c('keybinds').t`Shift`}; - const bindC = {c('keybinds').t`C`}; const starhouseLink = starhouse ; const vinikLink = Vinikdev; diff --git a/src/socket/MessageBroker.js b/src/socket/MessageBroker.js index d1e3ae7..24dfe42 100644 --- a/src/socket/MessageBroker.js +++ b/src/socket/MessageBroker.js @@ -176,6 +176,11 @@ class MessageBroker extends SocketEvents { */ async onShardListenMessage(message) { try { + if (message === 'ping') { + const channel = `${LISTEN_PREFIX}:${this.thisShard}`; + this.pings[channel] = Date.now(); + return; + } const comma = message.indexOf(','); const key = message.slice(0, comma); console.log(`CLUSTER shard listener got ${key}`); @@ -443,6 +448,8 @@ class MessageBroker extends SocketEvents { } // send keep alive to others this.publisher.publish(BROADCAST_CHAN, this.thisShard); + // ping to own text listener channel + this.publisher.publish(`${LISTEN_PREFIX}:${this.thisShard}`, 'ping'); // clean up dead shard requests threshold -= 30000; this.csReq = this.csReq.filter((r) => r.ts > threshold);