feat: introduce const for broadcast interval

- change ticker to use BROADCAST_INTERVAL constant
- define BROADCAST_INTERVAL as 1 second

🤖
This commit is contained in:
Sebastian Mark 2024-11-21 18:54:08 +01:00
parent 7f034b2c4e
commit 3960216647
2 changed files with 2 additions and 1 deletions

View file

@ -11,7 +11,7 @@ import (
// Sends continous messages to all connected WebSocket clients // Sends continous messages to all connected WebSocket clients
func SendPermanentBroadCastMessage() { func SendPermanentBroadCastMessage() {
ticker := time.NewTicker(time.Second) ticker := time.NewTicker(BROADCAST_INTERVAL * time.Second)
defer ticker.Stop() defer ticker.Stop()
for range ticker.C { for range ticker.C {

View file

@ -7,6 +7,7 @@ import (
"git.smsvc.net/pomodoro/GoTomato/pkg/models" "git.smsvc.net/pomodoro/GoTomato/pkg/models"
) )
const BROADCAST_INTERVAL = 1
const SEND_TIMEOUT = 10 const SEND_TIMEOUT = 10
const STALE_CLIENT_TIMEOUT = 90 const STALE_CLIENT_TIMEOUT = 90
const STALE_CHECK_INTERVALL = 30 const STALE_CHECK_INTERVALL = 30