refactor shards subscription

This commit is contained in:
HF 2022-09-11 14:52:20 +02:00
parent 3946614b3a
commit 5e61aea368

View File

@ -78,6 +78,7 @@ class MessageBroker extends SocketEvents {
}
if (!this.shards[message]) {
console.log(`CLUSTER: Shard ${message} connected`);
this.shards[message] = Date.now();
await this.subscriber.subscribe(
message,
(buffer) => this.onShardBinaryMessage(buffer, message),
@ -85,6 +86,7 @@ class MessageBroker extends SocketEvents {
);
// immediately give new shards informations
this.publisher.publish('bc', this.thisShard);
return;
}
this.shards[message] = Date.now();
return;