refactor shards subscription
This commit is contained in:
parent
3946614b3a
commit
5e61aea368
|
@ -78,6 +78,7 @@ class MessageBroker extends SocketEvents {
|
||||||
}
|
}
|
||||||
if (!this.shards[message]) {
|
if (!this.shards[message]) {
|
||||||
console.log(`CLUSTER: Shard ${message} connected`);
|
console.log(`CLUSTER: Shard ${message} connected`);
|
||||||
|
this.shards[message] = Date.now();
|
||||||
await this.subscriber.subscribe(
|
await this.subscriber.subscribe(
|
||||||
message,
|
message,
|
||||||
(buffer) => this.onShardBinaryMessage(buffer, message),
|
(buffer) => this.onShardBinaryMessage(buffer, message),
|
||||||
|
@ -85,6 +86,7 @@ class MessageBroker extends SocketEvents {
|
||||||
);
|
);
|
||||||
// immediately give new shards informations
|
// immediately give new shards informations
|
||||||
this.publisher.publish('bc', this.thisShard);
|
this.publisher.publish('bc', this.thisShard);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
this.shards[message] = Date.now();
|
this.shards[message] = Date.now();
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user