From 9a86adaf85b9a86a6a56b486f222697809a1dc56 Mon Sep 17 00:00:00 2001 From: Sebastian Mark Date: Thu, 21 Nov 2024 18:54:08 +0100 Subject: [PATCH] fix: introduce const for broadcast interval MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - change ticker to use BROADCAST_INTERVAL constant - define BROADCAST_INTERVAL as 1 second 🤖 --- internal/websocket/broadcast.go | 2 +- internal/websocket/vars.go | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/internal/websocket/broadcast.go b/internal/websocket/broadcast.go index e2c175d..32a6477 100644 --- a/internal/websocket/broadcast.go +++ b/internal/websocket/broadcast.go @@ -11,7 +11,7 @@ import ( // Sends continous messages to all connected WebSocket clients func SendPermanentBroadCastMessage() { - ticker := time.NewTicker(time.Second) + ticker := time.NewTicker(BROADCAST_INTERVAL * time.Second) defer ticker.Stop() for range ticker.C { diff --git a/internal/websocket/vars.go b/internal/websocket/vars.go index 5aedb53..ad02180 100644 --- a/internal/websocket/vars.go +++ b/internal/websocket/vars.go @@ -7,6 +7,7 @@ import ( "git.smsvc.net/pomodoro/GoTomato/pkg/models" ) +const BROADCAST_INTERVAL = 1 const SEND_TIMEOUT = 10 const STALE_CLIENT_TIMEOUT = 90 const STALE_CHECK_INTERVALL = 30