mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 19:28:17 +00:00
finalizing comments
This commit is contained in:
@@ -104,7 +104,6 @@ export async function tellClusterToIdentify(
|
|||||||
) {
|
) {
|
||||||
// When resharding
|
// When resharding
|
||||||
const oldShard = ws.shards.get(shardID);
|
const oldShard = ws.shards.get(shardID);
|
||||||
// TODO: resolve promise 5 sec after ready
|
|
||||||
await ws.identify(shardID, ws.maxShards);
|
await ws.identify(shardID, ws.maxShards);
|
||||||
|
|
||||||
if (oldShard) {
|
if (oldShard) {
|
||||||
|
|||||||
+12
-3
@@ -60,9 +60,9 @@ export const ws = {
|
|||||||
/** Milliseconds left until limit is reset. */
|
/** Milliseconds left until limit is reset. */
|
||||||
resetAfter: 0,
|
resetAfter: 0,
|
||||||
/** The number of identify requests allowed per 5 seconds.
|
/** The number of identify requests allowed per 5 seconds.
|
||||||
* So, if you had a max concurrency of 16, and 16 shards for example, you could start them all up at the same time.
|
* So, if you had a max concurrency of 16, and 16 shards for example, you could start them all up at the same time.
|
||||||
* Whereas if you had 32 shards, if you tried to start up shard 0 and 16 at the same time for example, it would not work. You can start shards 0-15 concurrently, then 16-31...
|
* Whereas if you had 32 shards, if you tried to start up shard 0 and 16 at the same time for example, it would not work. You can start shards 0-15 concurrently, then 16-31...
|
||||||
* */
|
*/
|
||||||
maxConcurrency: 1,
|
maxConcurrency: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@@ -84,13 +84,21 @@ export const ws = {
|
|||||||
startGateway,
|
startGateway,
|
||||||
/** The handler for spawning ALL the shards. */
|
/** The handler for spawning ALL the shards. */
|
||||||
spawnShards,
|
spawnShards,
|
||||||
|
/** Create the websocket and adds the proper handlers to the websocket. */
|
||||||
createShard,
|
createShard,
|
||||||
|
/** Begins identification of the shard to discord */
|
||||||
identify,
|
identify,
|
||||||
|
/** Begins heartbeating of the shard to keep it alive */
|
||||||
heartbeat,
|
heartbeat,
|
||||||
|
/** Sends the discord payload to another server. */
|
||||||
handleDiscordPayload,
|
handleDiscordPayload,
|
||||||
|
/** Tell the cluster/worker to begin identifying this shard */
|
||||||
tellClusterToIdentify,
|
tellClusterToIdentify,
|
||||||
|
/** Handle the different logs. Used for debugging. */
|
||||||
log,
|
log,
|
||||||
|
/** Handles resharding the bot when necessary. */
|
||||||
resharder,
|
resharder,
|
||||||
|
/** Cleanups loading shards that were unable to load. */
|
||||||
cleanupLoadingShards,
|
cleanupLoadingShards,
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -99,6 +107,7 @@ export interface DiscordenoShard {
|
|||||||
id: number;
|
id: number;
|
||||||
/** The websocket for this shard */
|
/** The websocket for this shard */
|
||||||
ws: WebSocket;
|
ws: WebSocket;
|
||||||
|
/** The amount of milliseconds to wait between heartbeats */
|
||||||
resumeInterval: number;
|
resumeInterval: number;
|
||||||
/** The session id important for resuming connections. */
|
/** The session id important for resuming connections. */
|
||||||
sessionID: string;
|
sessionID: string;
|
||||||
|
|||||||
Reference in New Issue
Block a user