oven-sh / bun

Incredibly fast JavaScript runtime, bundler, test runner, and package manager – all in one
https://bun.sh
Other
71.75k stars 2.55k forks source link

discord-hybrid-sharding error #11330

Open DesertGamer opened 1 month ago

DesertGamer commented 1 month ago

What version of Bun is running?

1.1.8+89d25807f

What platform is your computer?

Microsoft Windows NT 10.0.22621.0 x64

What steps can reproduce the bug?

  1. Install the discord-hybrid-sharding package
  2. Create the cluster.js file, which will contain the ClusterManager for managing the processes/clusters.
    
    // Typescript: import { ClusterManager } from 'discord-hybrid-sharding'
    const { ClusterManager } = require('discord-hybrid-sharding');

const manager = new ClusterManager(${__dirname}/bot.js, { totalShards: 'auto', // or numeric shard count /// Check below for more options shardsPerClusters: 2, // 2 shards per process // totalClusters: 7, mode: 'process', // you can also choose "worker" token: 'YOUR_TOKEN', });

manager.on('clusterCreate', cluster => console.log(Launched Cluster ${cluster.id})); manager.spawn({ timeout: -1 });

3. Refactor your main bot.js file and provide the sharding parameters to your discord.js client.
```TS
// Typescript: import { ClusterClient, getInfo } from 'discord-hybrid-sharding'
const { ClusterClient, getInfo } = require('discord-hybrid-sharding');
const Discord = require('discord.js');

const client = new Discord.Client({
    shards: getInfo().SHARD_LIST, // An array of shards that will get spawned
    shardCount: getInfo().TOTAL_SHARDS, // Total number of shards
});

client.cluster = new ClusterClient(client); // initialize the Client, so we access the .broadcastEval()
client.login('YOUR_TOKEN');
  1. Try to get the number of servers that are in total on the clusters: сlient.cluster.fetchClientValues("guilds.cache.size")

What is the expected behavior?

The script outputs an array of the number of servers on each shard

What do you see instead?

Emptiness, as if the algorithm is not running

Additional information

No response

DesertGamer commented 1 month ago

The library developers say that the IPC algorithm does not work correctly in Bun image