We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8996e78 commit 9312e7cCopy full SHA for 9312e7c
api/nginx/websocket.go
@@ -106,9 +106,17 @@ func (h *NginxPerformanceHub) sendPerformanceDataToClient(client *NginxPerforman
106
107
// broadcastPerformanceData sends performance data to all connected clients
108
func (h *NginxPerformanceHub) broadcastPerformanceData() {
109
+ h.mutex.RLock()
110
+
111
+ // Check if there are any connected clients
112
+ if len(h.clients) == 0 {
113
+ h.mutex.RUnlock()
114
+ return
115
+ }
116
117
+ // Only get performance data if there are connected clients
118
response := performance.GetPerformanceData()
119
- h.mutex.RLock()
120
for client := range h.clients {
121
select {
122
case client.send <- response:
0 commit comments