From dc1c9a1f82294f23ae56ac6d98ba4892a2d19617 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Sat, 17 Dec 2022 09:46:38 -0500 Subject: [PATCH] *Change heartbeat check to 1/4 the heartBeatInterval rate --- src/index.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index 481a357..3d80901 100644 --- a/src/index.ts +++ b/src/index.ts @@ -75,7 +75,10 @@ export default class DHTCache extends EventEmitter { }); this._ensurePeer(this.id); - setInterval(() => this._heartbeatCheck(), 5 * 1000); + setInterval( + () => this._heartbeatCheck(), + (this.heartBeatInterval / 4) * 1000 + ); setInterval(() => this._emitHeartbeat(), this.heartBeatInterval * 1000); }