Question: how to implement sharding while keeping the API functionality
how to implement sharding while keeping the API functionality, I tried getting the queue using useQueue from discord-player while sharding and sadly there's no data
useQueue does work, @mariusbegby did it with cadence bot. Correct shard with correct guild id should work just fine when invoked from discord.
However the website may not work with shards using current setup, as any of the shard may receive the request. The overall design of this project does not involve sharding in mind but I will be happy to include this feature in the future.
@ig4e there should be no special considerations when using useQueue() and sharding. For example, look at this pause command and how useQueue() is implemented: https://github.com/mariusbegby/cadence-discord-bot/blob/main/src/interactions/slashcommands/pause.ts
It just takes guild id as normal.
@mariusbegby There are no special considerations on the bot side, but it currently doesn't manage/detect shards on the API side.
How will communication between different shards/processes with discord-player bindings be implemented?
useQueue does work, @mariusbegby did it with cadence bot. Correct shard with correct guild id should work just fine when invoked from discord.
However the website may not work with shards using current setup, as any of the shard may receive the request. The overall design of this project does not involve sharding in mind but I will be happy to include this feature in the future.
Thanks! I would love to see how it's done, I appreciate it if you could give me a hint ^^
@ig4e I am not sure what problem you are running into. I am sharding using discord.js, nothing fancy and it works out of the box. I don't need a different setup of discord-player to get it to work with sharding. It works exactly the same as if no sharding would be used.
Hopefully you get something working, but I honestly cannot see what the problem is here.
as far as I understand, @ig4e is talking about the website part, which I've already responded to saying
However the website may not work with shards using current setup, as any of the shard may receive the request. The overall design of this project does not involve sharding in mind but I will be happy to include this feature in the future.
The website part may not receive correct shard because there would also be multiple clusters of web servers working simultaneously meaning any of those would receive the request we send. This was not considered while implementing the api, due to which it is not possible to use the website with shards at the moment. We'll need to update the code to include data from all shards in the rest api part.