1.0.21 • Published 5 years ago

eris-clusters v1.0.21

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

This is a clustering module based off of eris-sharder

Clustering splits big bots with many shards into multiple processes

For every 20 shards (or if they round up to the next 20), you gain another cluster, 40 shards, 2 clusters, and for 55 shards, 3 clusters, and the shards will be spready evenly across all of the clusters.

Each cluster is ran in its own process, so the more clusters, the more proccesses you will have.

It's quite late right now, and I don't want to document everything right now, but there is some typescript documentation in index.d.ts, I will provide some basic stuff though:

To start, you need to make a cluster manager:

const { ClusterManager, Base } = require("eris-clusters");
// whatever your main class is, it must extend Base, and must use this same constructor/super
class Main extends Base {
	constructor(bot) {
		super(bot);
	}

	async launch(cluster) {

	}
}

// the second argument is your main class, an example is above
// you MUST provide a Main class, this is NOT optional!
const manager = new ClusterManager("token", Main, {
	shardCount: "auto",
	clusterCount: "auto",
	guildsPerShard: 1000
});

// the manager will not start without calling this
manager.init();