From 01050138c66206e48d9d5472e65b6868058a57d0 Mon Sep 17 00:00:00 2001 From: gabrielmer <101006718+gabrielmer@users.noreply.github.com> Date: Mon, 24 Jun 2024 10:20:09 +0200 Subject: [PATCH] fix: only set disconnect time on left event (#2831) --- waku/node/peer_manager/peer_manager.nim | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/waku/node/peer_manager/peer_manager.nim b/waku/node/peer_manager/peer_manager.nim index d1b6299be..17d6f808c 100644 --- a/waku/node/peer_manager/peer_manager.nim +++ b/waku/node/peer_manager/peer_manager.nim @@ -442,7 +442,9 @@ proc onPeerEvent(pm: PeerManager, peerId: PeerId, event: PeerEvent) {.async.} = if not pm.storage.isNil: var remotePeerInfo = pm.peerStore.get(peerId) - remotePeerInfo.disconnectTime = getTime().toUnix + + if event.kind == PeerEventKind.Left: + remotePeerInfo.disconnectTime = getTime().toUnix pm.storage.insertOrReplace(remotePeerInfo)