Scheduled message causes duplicate messages in sharded app
I have a sharded bot that sends reminders, but sometimes the bot sends duplicate messages. I'm not sure how to prevent this. I've tried:
- Storing the messageId in redis for 10 mins after successfully sending a message, then checking if redis has the messageId before sending, if not found, I send the message
- Implemented mutex
I've observed duplicate reminders are being sent when too many messages are sent
Yet duplicate reminders are being sent. I'm not sure if this is the correct, what's the standard way to do reminders in a sharded bot?
2 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by staffwouldn't that cause duplicate reminders to be sent too? Cuz each shard will try to dm the user?
If I decide to use ShardingManager process, ig I'll have to use @discordjs/core?
Ah okay. I'll try thank you
I'd also like to know how do I reload commands on all shards if
commands
is not attached to my client
instance
Aight, thank you for your time