UNPKG

status-sharding

Version:

Welcome to Status Sharding! This package is designed to provide an efficient and flexible solution for sharding Discord bots, allowing you to scale your bot across multiple processes or workers.

34 lines (33 loc) 1.21 kB
import { ClusterManager } from '../core/clusterManager'; import { HeartbeatData } from '../types'; /** Handles heartbeats for the cluster manager. */ export declare class HeartbeatManager { private readonly manager; /** The interval of the heartbeat. */ private readonly interval; /** The list of heartbeat data per cluster. */ private readonly beats; /** Clusters currently being checked to avoid overlapping checks. */ private readonly processing; /** Creates an instance of HeartbeatManager. */ constructor(manager: ClusterManager); private checkCluster; /** Stops the heartbeat. */ stop(): void; /** Gets the heartbeat data for a cluster. */ getClusterStats(id: number): HeartbeatData; /** Removes a cluster from the heartbeat. */ removeCluster(id: number): void; /** Adds a missed beat to a cluster. */ private addMissedBeat; /** Check if cluster process/thread is actually alive. */ private isClusterProcessAlive; /** Handle detected crash */ private handleCrashedCluster; getHealthSummary(): { clusterId: number; status: string; missedBeats: number; restarts: number; }[]; }