Util
Hub containing some useful utils for other clusters.
Constructor
new Util(cid);
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
cid | number | ❌ | undefined | Cluster ID. |
Methods
getStats
Requests stats from all clusters and returns an array.
getStats();
Returns
Promise< ClusterStats[] >
getStatsFrom
Returns stats on a specfic cluster and the shards it contains etc.
getStatsFrom(clusterId);
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
clusterId | number | ❌ | null | Cluster identifier. |
Returns
Promise< ClusterStats | undefined >
broadcastEval
Sends callback as a string to every cluster then uses eval
to evaulate your code on that cluster. It will return an
array of objects which will contain cluster info and the
result/error that occured.
broadcastEval(callback, references);
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
callback | BroadcastEvalCallback | ❌ | undefined | Callback function to be evaulated. |
references | object? | ✔️ | undefined | Callback function to be evaulated. |
Returns
Promise< BroadcastEvalResponse[] >
disposeOf
Sends a request to specified cluster to dispose itself.
Will result in the cluster exiting with code 0 and being automatically
restarted by ClusterUtil
.
disposeOf(clusterId);
PARAMETER | TYPE | OPTIONAL | DEFAULT | DESCRIPTION |
---|---|---|---|---|
clusterId | number | ❌ | null | Cluster identifier. |
Returns
void