Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

spawnOptions doesn't work as expected #100

Open
KSJaay opened this issue Dec 19, 2024 · 2 comments
Open

spawnOptions doesn't work as expected #100

KSJaay opened this issue Dec 19, 2024 · 2 comments

Comments

@KSJaay
Copy link

KSJaay commented Dec 19, 2024

Describe the bug

If I define spawnOptions in the clusterManager, they aren't being passed when the cluster is being spawned. Seems like in the spawn function when you're destructuring the object and assigning default values, it's only assigning the default values and not the values from this.spawnOptions. I cloned the repo and tested locally, and saw the same results. However, if I destructured the object within the function, it worked fine.

It's really strange, and not sure why it's happening because it should be working as expected. Maybe I'm doing something wrong here...

(To Reproduce)

Link to function

Calling clusterManager:

const manager = new ClusterManager(`${__dirname}/main.js`, {
  totalShards: 4,
  totalClusters: 4,
  token: process.env.DISCORD_TOKEN,
  restarts: { max: 5, interval: 60000 * 60 },
  spawnOptions: { delay: 1500, timeout: 1500 },
});

Changes to spawn function:

console.log('this.spawnOptions', this.spawnOptions);
console.log('delay', delay);
console.log('timeout', timeout);

Output:

this.spawnOptions { delay: 1500, timeout: 1500 }
delay 7000
timeout -1

Expected:

this.spawnOptions { delay: 1500, timeout: 1500 }
delay 1500
timeout 1500

Discord.js Version

  • Discord.js - 14.16.2
  • Discord-hybrid-sharding - 2.2.0
@meister03
Copy link
Owner

@KSJaay could you test it with the latest version 2.2.3

@KSJaay
Copy link
Author

KSJaay commented Jan 5, 2025

Just tested and still seeing the same issue on 2.2.3 as well @meister03

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants