From 4537803f52ff2e7ec258073919afbc10a54b096f Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Mon, 18 Nov 2024 19:53:21 +0100 Subject: [PATCH] refactor: remove unused variable prevMessage MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - update logic to send current serverMessage instead of prevMessage - simplify message processing for improved clarity 🤖 --- internal/websocket/receive.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/internal/websocket/receive.go b/internal/websocket/receive.go index 7912de3..510ad34 100644 --- a/internal/websocket/receive.go +++ b/internal/websocket/receive.go @@ -14,7 +14,7 @@ var Done = make(chan struct{}) // Receives websocket messages and writes them to a channel. // Closes the channel if websocket closes. func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) { - var serverMessage, prevMessage GoTomato.ServerMessage + var serverMessage GoTomato.ServerMessage defer close(Done) @@ -30,7 +30,7 @@ func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) { c.LastErr = err // Try to reconnect on unexpected disconnect for { - channel <- prevMessage // send previous ServerMessage to update view + channel <- serverMessage // send last known ServerMessage to update view time.Sleep(time.Second) @@ -50,6 +50,5 @@ func (c *Client) ProcessServerMessages(channel chan<- GoTomato.ServerMessage) { c.LastErr = err channel <- serverMessage - prevMessage = serverMessage } }