mirror of
https://github.com/komari-monitor/komari.git
synced 2025-11-02 21:13:27 +00:00
feat: #57 增加connectedClients、latestReport线程安全
This commit is contained in:
@@ -25,7 +25,7 @@ func Exec(c *gin.Context) {
|
||||
api.RespondError(c, 400, "Invalid or missing request body: "+err.Error())
|
||||
return
|
||||
}
|
||||
for uuid := range ws.ConnectedClients {
|
||||
for uuid := range ws.GetConnectedClients() {
|
||||
if contain(req.Clients, uuid) {
|
||||
onlineClients = append(onlineClients, uuid)
|
||||
} else {
|
||||
@@ -53,7 +53,7 @@ func Exec(c *gin.Context) {
|
||||
send.TaskId = taskId
|
||||
|
||||
payload, _ := json.Marshal(send)
|
||||
client := ws.ConnectedClients[uuid]
|
||||
client := ws.GetConnectedClients()[uuid]
|
||||
if client != nil {
|
||||
client.WriteMessage(websocket.TextMessage, payload)
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user