diff --git a/lib/cluster-adapter.ts b/lib/cluster-adapter.ts index 8061f2a..7482d03 100644 --- a/lib/cluster-adapter.ts +++ b/lib/cluster-adapter.ts @@ -719,13 +719,14 @@ export abstract class ClusterAdapterWithHeartbeat extends ClusterAdapter { private scheduleHeartbeat() { if (this.heartbeatTimer) { - clearTimeout(this.heartbeatTimer); + this.heartbeatTimer.refresh(); + } else { + this.heartbeatTimer = setTimeout(() => { + this.publish({ + type: MessageType.HEARTBEAT, + }); + }, this._opts.heartbeatInterval); } - this.heartbeatTimer = setTimeout(() => { - this.publish({ - type: MessageType.HEARTBEAT, - }); - }, this._opts.heartbeatInterval); } override close() {