seyfert/packages/discordeno/gateway/shard/stopHeartbeating.ts
2022-07-08 01:33:29 -05:00

10 lines
366 B
TypeScript

import { Shard } from "./types.ts";
export function stopHeartbeating(shard: Shard): void {
// Clear the regular heartbeat interval.
clearInterval(shard.heart.intervalId);
// It's possible that the Shard got closed before the first jittered heartbeat.
// To go safe we should clear the related timeout too.
clearTimeout(shard.heart.timeoutId);
}