conny.
conny.
DIAdiscord.js - Imagine an app
Created by conny. on 12/30/2023 in #djs-questions
How are you guys realizing horizontal scaling with djs?
Hey everyone! We're facing a bit of a puzzle on our end. Tired of the server upgrade routine, we're playing around with the idea of spreading our workload across smaller servers for a more horizontal setup. The potential perk? It could be a game-changer for our budget. Now, here's where it gets interesting. Djs, isn't quite on board with the whole selective shard handling thing straight out of the box, unlike some other libraries like Serenity for Rust. We're not stressing about it, though. We're just curious – how are you handling this in your setups? Any ideas or solutions you've stumbled upon? Let's have a chat about it. ^^ Appreciate it a ton for joining the conversation! Best, conny.
20 replies
DIAdiscord.js - Imagine an app
Created by conny. on 9/12/2022 in #djs-questions
Bot (shards) keeps rebooting, causing me to hit the identify limit of 1k
Hey Guys, i already sent this message in #djs-help-v14 but though it'd be a better idea to post it here. Since i updated to djs 14 my bot (or some shards of it) keep rebooting seemingly at random.. This is my output including debug and warn logs:
info: Launching shard... {"shard":1,"timestamp":""}
Provided token: ***************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 963
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 297ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 34435
[WS => Shard 0] [READY] Session 01ad68bc9e809ef677947ed43e3c302e.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
info: Shard connected to Discord's Gateway. {"shard":1,"timestamp":""}
[1] Started deleting deprecated application (/) commands.
[WS => Shard 0] Heartbeat acknowledged, latency of 125ms.
[1] Started refreshing application (/) commands.
[1] Successfully reloaded local application (/) commands.
[1] Shard booted!

Provided token: ***************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 962
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 228ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 34435
[WS => Shard 0] [READY] Session 2920db5e445e0fef255dde96ccf3b0b7.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
info: Shard connected to Discord's Gateway. {"shard":1,"timestamp":""}
[1] Started deleting deprecated application (/) commands.
[WS => Shard 0] Heartbeat acknowledged, latency of 131ms.
[1] Started refreshing application (/) commands.
[1] Successfully reloaded local application (/) commands.
[1] Shard booted!

... in a loop
info: Launching shard... {"shard":1,"timestamp":""}
Provided token: ***************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 963
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 297ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 34435
[WS => Shard 0] [READY] Session 01ad68bc9e809ef677947ed43e3c302e.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
info: Shard connected to Discord's Gateway. {"shard":1,"timestamp":""}
[1] Started deleting deprecated application (/) commands.
[WS => Shard 0] Heartbeat acknowledged, latency of 125ms.
[1] Started refreshing application (/) commands.
[1] Successfully reloaded local application (/) commands.
[1] Shard booted!

Provided token: ***************************
Preparing to connect to the gateway...
[WS => Manager] Fetched Gateway Information
URL: wss://gateway.discord.gg
Recommended Shards: 1
[WS => Manager] Session Limit Information
Total: 1000
Remaining: 962
[WS => Manager] Spawning shards: 0
[WS => Shard 0] [CONNECT]
Gateway : wss://gateway.discord.gg/
Version : 10
Encoding : json
Compression: none
[WS => Shard 0] Setting a HELLO timeout for 20s.
[WS => Shard 0] [CONNECTED] Took 228ms
[WS => Shard 0] Clearing the HELLO timeout.
[WS => Shard 0] Setting a heartbeat interval for 41250ms.
[WS => Shard 0] [IDENTIFY] Shard 0/1 with intents: 34435
[WS => Shard 0] [READY] Session 2920db5e445e0fef255dde96ccf3b0b7.
[WS => Shard 0] [ReadyHeartbeat] Sending a heartbeat.
[WS => Shard 0] Shard received all its guilds. Marking as fully ready.
info: Shard connected to Discord's Gateway. {"shard":1,"timestamp":""}
[1] Started deleting deprecated application (/) commands.
[WS => Shard 0] Heartbeat acknowledged, latency of 131ms.
[1] Started refreshing application (/) commands.
[1] Successfully reloaded local application (/) commands.
[1] Shard booted!

... in a loop
I cant - for the love of god find the issue. In this example it happens right on boot - but on my other bot with many more shards it does just happen at random during service causing my bot to hit the 1k identify limit per 24h What i should do? I also saw someone here asking where the REST init code is place. Idk why i think this migh be interesting to this issue but its placed right in the ready listener.
// bot.ts
botClient.once("ready", async () => {
await readyListener();
});

//readyListener()
async function readyListener() {
await registerGuildCommands();
console.log(`[${shardID}] Shard booted!`);
// more stuff...
}
// bot.ts
botClient.once("ready", async () => {
await readyListener();
});

//readyListener()
async function readyListener() {
await registerGuildCommands();
console.log(`[${shardID}] Shard booted!`);
// more stuff...
}
Thanks very much for the help! - Best regards djs v14.03.0 | node v16.17.0
9 replies