seyfert 2.1.1-dev-12309470171.0 → 2.1.1-dev-12316533544.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -193,10 +193,9 @@ class WorkerClient extends base_1.BaseClient {
|
|
|
193
193
|
...this.options.gateway?.properties,
|
|
194
194
|
},
|
|
195
195
|
handlePayload(_, payload) {
|
|
196
|
-
if (payload.t
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
else if (payload.t === 'GUILDS_READY' && shardsConnected === workerData.shards.length) {
|
|
196
|
+
if (payload.t !== 'GUILDS_READY')
|
|
197
|
+
return;
|
|
198
|
+
if (++shardsConnected === workerData.shards.length) {
|
|
200
199
|
self.postMessage({
|
|
201
200
|
type: 'WORKER_READY_RESHARDING',
|
|
202
201
|
workerId: workerData.workerId,
|
|
@@ -105,31 +105,21 @@ class ShardManager extends Map {
|
|
|
105
105
|
this.options.info.session_start_limit.max_concurrency = info.session_start_limit.max_concurrency;
|
|
106
106
|
//waiting for all shards to connect
|
|
107
107
|
let shardsConnected = 0;
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
if (packet.t === 'GUILD_CREATE' || packet.t === 'GUILD_DELETE') {
|
|
111
|
-
handleGuilds.delete(packet.d.id);
|
|
112
|
-
if (shardsConnected === info.shards && !handleGuilds.size) {
|
|
113
|
-
return cleanProcess(sharder);
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
if (packet.t !== 'READY')
|
|
108
|
+
let handlePayload = (sharder, _, packet) => {
|
|
109
|
+
if (packet.t !== 'GUILDS_READY')
|
|
117
110
|
return;
|
|
118
|
-
|
|
119
|
-
handleGuilds.add(guild.id);
|
|
120
|
-
}
|
|
121
|
-
if (++shardsConnected < info.shards || handleGuilds.size)
|
|
111
|
+
if (++shardsConnected !== info.shards)
|
|
122
112
|
return;
|
|
123
113
|
cleanProcess(sharder);
|
|
124
114
|
// dont listen more events when all shards are ready
|
|
125
115
|
};
|
|
126
116
|
const cleanProcess = (sharder) => {
|
|
127
|
-
handlePayload =
|
|
117
|
+
handlePayload = () => {
|
|
128
118
|
//
|
|
129
119
|
};
|
|
130
120
|
this.disconnectAll();
|
|
131
121
|
this.clear();
|
|
132
|
-
this.options.totalShards = this.options.shardEnd = info.shards;
|
|
122
|
+
this.options.totalShards = this.options.shardEnd = this.options.info.shards = info.shards;
|
|
133
123
|
for (const [id, shard] of sharder) {
|
|
134
124
|
shard.options.handlePayload = (shardId, packet) => {
|
|
135
125
|
return this.options.handlePayload(shardId, packet);
|
|
@@ -234,7 +234,7 @@ class WorkerManager extends Map {
|
|
|
234
234
|
this.get(message.workerId).disconnected = true;
|
|
235
235
|
if ([...this.values()].every(w => w.disconnected)) {
|
|
236
236
|
this.options.totalShards = this._info.shards;
|
|
237
|
-
this.options.shardEnd = this.options.totalShards = this._info.shards;
|
|
237
|
+
this.options.shardEnd = this.options.totalShards = this.options.info.shards = this._info.shards;
|
|
238
238
|
this.options.workers = this.size;
|
|
239
239
|
delete this._info;
|
|
240
240
|
for (const [id] of this.entries()) {
|
|
@@ -538,7 +538,7 @@ class WorkerManager extends Map {
|
|
|
538
538
|
shardEnd: info.shards,
|
|
539
539
|
shardStart: 0,
|
|
540
540
|
}, this.debugger);
|
|
541
|
-
|
|
541
|
+
this.prepareWorkers(spaces, true);
|
|
542
542
|
return this.reshardingWorkerQueue.shift()();
|
|
543
543
|
}, this.options.resharding.interval);
|
|
544
544
|
}
|