From a0d0f429e97cf02ba7ff0a8e3066e5d388d46a12 Mon Sep 17 00:00:00 2001 From: nick Date: Thu, 22 Aug 2024 13:27:47 +0900 Subject: [PATCH] feat: update timer relative to last update time --- node/pkg/wss/utils.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/node/pkg/wss/utils.go b/node/pkg/wss/utils.go index 2ffb2aebb..ad6090bed 100644 --- a/node/pkg/wss/utils.go +++ b/node/pkg/wss/utils.go @@ -98,11 +98,11 @@ func (ws *WebsocketHelper) Run(ctx context.Context, router func(context.Context, log.Info().Str("endpoint", ws.Endpoint).Msg("reconnect interval exceeded during read, closing websocket") break innerLoop case <-inactivityTimer.C: - inactivityTimer.Reset(ws.InactivityTimeout) if time.Since(ws.lastMessageTime) > ws.InactivityTimeout { log.Info().Str("endpoint", ws.Endpoint).Msg("inactivity timeout exceeded, closing websocket") break innerLoop } + inactivityTimer.Reset(ws.InactivityTimeout - time.Since(ws.lastMessageTime)) default: data, err := readFunc(ctx, ws.Conn) if err != nil {